From 67c18d6b5188a0497f6912a73d964c763d2f8f84 Mon Sep 17 00:00:00 2001 From: Robert Phillips Date: Fri, 20 Jan 2017 12:44:06 -0500 Subject: Continue making Ganesh use absolute texture coordinates - take 2 The idea here is that the GrCoordTransform will actually hold a GrTextureProxy (rather than a GrTexture) and then, in GrGLSLPrimitiveProcessor::GetTransformMatrix, use the instantiated width & height (when uploading the transform matrix) Relanding of: https://skia-review.googlesource.com/c/6977/ Change-Id: Ibc9b9e354f7fc23b1a6e6e4fe7c9fe3cef771c02 Reviewed-on: https://skia-review.googlesource.com/7265 Reviewed-by: Brian Salomon Commit-Queue: Robert Phillips --- tests/ImageNewShaderTest.cpp | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) (limited to 'tests/ImageNewShaderTest.cpp') diff --git a/tests/ImageNewShaderTest.cpp b/tests/ImageNewShaderTest.cpp index a92a4be4d5..4091db0d9b 100644 --- a/tests/ImageNewShaderTest.cpp +++ b/tests/ImageNewShaderTest.cpp @@ -16,7 +16,7 @@ #include "GrContext.h" #endif -void testBitmapEquality(skiatest::Reporter* reporter, SkBitmap& bm1, SkBitmap& bm2) { +static void test_bitmap_equality(skiatest::Reporter* reporter, SkBitmap& bm1, SkBitmap& bm2) { SkAutoLockPixels lockBm1(bm1); SkAutoLockPixels lockBm2(bm2); @@ -24,7 +24,7 @@ void testBitmapEquality(skiatest::Reporter* reporter, SkBitmap& bm1, SkBitmap& b REPORTER_ASSERT(reporter, 0 == memcmp(bm1.getPixels(), bm2.getPixels(), bm1.getSize())); } -void paintSource(SkSurface* sourceSurface) { +static void paint_source(SkSurface* sourceSurface) { SkCanvas* sourceCanvas = sourceSurface->getCanvas(); sourceCanvas->clear(0xFFDEDEDE); @@ -41,8 +41,9 @@ void paintSource(SkSurface* sourceSurface) { sourceCanvas->drawRect(rect, paintColor); } -void runShaderTest(skiatest::Reporter* reporter, SkSurface* sourceSurface, SkSurface* destinationSurface, SkImageInfo& info) { - paintSource(sourceSurface); +static void run_shader_test(skiatest::Reporter* reporter, SkSurface* sourceSurface, + SkSurface* destinationSurface, SkImageInfo& info) { + paint_source(sourceSurface); sk_sp sourceImage(sourceSurface->makeImageSnapshot()); sk_sp sourceShader = sourceImage->makeShader( @@ -65,9 +66,7 @@ void runShaderTest(skiatest::Reporter* reporter, SkSurface* sourceSurface, SkSur SkBitmap bm; destinationCanvas->readPixels(rect, &bm); - testBitmapEquality(reporter, bmOrig, bm); - - + test_bitmap_equality(reporter, bmOrig, bm); // Test with a translated shader SkMatrix matrix; @@ -107,47 +106,47 @@ DEF_TEST(ImageNewShader, reporter) { auto sourceSurface(SkSurface::MakeRaster(info)); auto destinationSurface(SkSurface::MakeRaster(info)); - runShaderTest(reporter, sourceSurface.get(), destinationSurface.get(), info); + run_shader_test(reporter, sourceSurface.get(), destinationSurface.get(), info); } #if SK_SUPPORT_GPU -void gpuToGpu(skiatest::Reporter* reporter, GrContext* context) { +static void gpu_to_gpu(skiatest::Reporter* reporter, GrContext* context) { SkImageInfo info = SkImageInfo::MakeN32Premul(5, 5); auto sourceSurface(SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, info)); auto destinationSurface(SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, info)); - runShaderTest(reporter, sourceSurface.get(), destinationSurface.get(), info); + run_shader_test(reporter, sourceSurface.get(), destinationSurface.get(), info); } -void gpuToRaster(skiatest::Reporter* reporter, GrContext* context) { +static void gpu_to_raster(skiatest::Reporter* reporter, GrContext* context) { SkImageInfo info = SkImageInfo::MakeN32Premul(5, 5); auto sourceSurface(SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, info)); auto destinationSurface(SkSurface::MakeRaster(info)); - runShaderTest(reporter, sourceSurface.get(), destinationSurface.get(), info); + run_shader_test(reporter, sourceSurface.get(), destinationSurface.get(), info); } -void rasterToGpu(skiatest::Reporter* reporter, GrContext* context) { +static void raster_to_gpu(skiatest::Reporter* reporter, GrContext* context) { SkImageInfo info = SkImageInfo::MakeN32Premul(5, 5); auto sourceSurface(SkSurface::MakeRaster(info)); auto destinationSurface(SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, info)); - runShaderTest(reporter, sourceSurface.get(), destinationSurface.get(), info); + run_shader_test(reporter, sourceSurface.get(), destinationSurface.get(), info); } DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageNewShader_GPU, reporter, ctxInfo) { // GPU -> GPU - gpuToGpu(reporter, ctxInfo.grContext()); + gpu_to_gpu(reporter, ctxInfo.grContext()); // GPU -> RASTER - gpuToRaster(reporter, ctxInfo.grContext()); + gpu_to_raster(reporter, ctxInfo.grContext()); // RASTER -> GPU - rasterToGpu(reporter, ctxInfo.grContext()); + raster_to_gpu(reporter, ctxInfo.grContext()); } #endif -- cgit v1.2.3