aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/ImageNewShaderTest.cpp
diff options
context:
space:
mode:
authorGravatar kkinnunen <kkinnunen@nvidia.com>2015-12-01 04:35:26 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-12-01 04:35:26 -0800
commit1530283c483cb88aa725bce50a6d193dd00ee570 (patch)
treec34d73ac28d83690a4cbf1196854176677e07366 /tests/ImageNewShaderTest.cpp
parent362c900625dc2ece854678455776b711c1e44c04 (diff)
Generate list of GPU contexts outside tests
Use DEF_GPUTEST_FOR_*_CONTEXT macros to obtain the test GPU context. Makes changing the context -related classes easier, since not all tests need to be changed. BUG=skia:2992 Review URL: https://codereview.chromium.org/1448873002
Diffstat (limited to 'tests/ImageNewShaderTest.cpp')
-rw-r--r--tests/ImageNewShaderTest.cpp38
1 files changed, 12 insertions, 26 deletions
diff --git a/tests/ImageNewShaderTest.cpp b/tests/ImageNewShaderTest.cpp
index c01fbe7ee8..2c25b90c69 100644
--- a/tests/ImageNewShaderTest.cpp
+++ b/tests/ImageNewShaderTest.cpp
@@ -5,17 +5,17 @@
* found in the LICENSE file.
*/
-#include "SkTypes.h"
-#if SK_SUPPORT_GPU
-#include "GrContextFactory.h"
-#endif
#include "SkCanvas.h"
#include "SkImage.h"
#include "SkShader.h"
#include "SkSurface.h"
-
+#include "SkTypes.h"
#include "Test.h"
+#if SK_SUPPORT_GPU
+#include "GrContext.h"
+#endif
+
void testBitmapEquality(skiatest::Reporter* reporter, SkBitmap& bm1, SkBitmap& bm2) {
SkAutoLockPixels lockBm1(bm1);
SkAutoLockPixels lockBm2(bm2);
@@ -143,29 +143,15 @@ void rasterToGpu(skiatest::Reporter* reporter, GrContext* context) {
runShaderTest(reporter, sourceSurface.get(), destinationSurface.get(), info);
}
-DEF_GPUTEST(ImageNewShader_GPU, reporter, factory) {
- for (int i = 0; i < GrContextFactory::kGLContextTypeCnt; ++i) {
- GrContextFactory::GLContextType glCtxType = (GrContextFactory::GLContextType) i;
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageNewShader_GPU, reporter, context) {
+ // GPU -> GPU
+ gpuToGpu(reporter, context);
- if (!GrContextFactory::IsRenderingGLContext(glCtxType)) {
- continue;
- }
-
- GrContext* context = factory->get(glCtxType);
-
- if (nullptr == context) {
- continue;
- }
+ // GPU -> RASTER
+ gpuToRaster(reporter, context);
- // GPU -> GPU
- gpuToGpu(reporter, context);
-
- // GPU -> RASTER
- gpuToRaster(reporter, context);
-
- // RASTER -> GPU
- rasterToGpu(reporter, context);
- }
+ // RASTER -> GPU
+ rasterToGpu(reporter, context);
}
#endif