aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/ImageNewShaderTest.cpp
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2017-01-20 12:44:06 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-01-20 18:18:18 +0000
commit67c18d6b5188a0497f6912a73d964c763d2f8f84 (patch)
treed32888c6b13589c2718fc6673f29acf2bb546c38 /tests/ImageNewShaderTest.cpp
parent41398f430dc501d450e04540a83b6aa5baf87cd7 (diff)
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 <bsalomon@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'tests/ImageNewShaderTest.cpp')
-rw-r--r--tests/ImageNewShaderTest.cpp33
1 files changed, 16 insertions, 17 deletions
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<SkImage> sourceImage(sourceSurface->makeImageSnapshot());
sk_sp<SkShader> 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