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>
diff --git a/tests/ImageNewShaderTest.cpp b/tests/ImageNewShaderTest.cpp
index a92a4be..4091db0 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 @@
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 @@
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 @@
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 @@
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