aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
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
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')
-rw-r--r--tests/ImageNewShaderTest.cpp33
-rw-r--r--tests/IntTextureTest.cpp5
-rw-r--r--tests/RectangleTextureTest.cpp6
-rw-r--r--tests/SRGBMipMapTest.cpp2
4 files changed, 21 insertions, 25 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
diff --git a/tests/IntTextureTest.cpp b/tests/IntTextureTest.cpp
index a3e17bf644..3edd4cc986 100644
--- a/tests/IntTextureTest.cpp
+++ b/tests/IntTextureTest.cpp
@@ -207,9 +207,8 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(IntTexture, reporter, ctxInfo) {
};
for (auto filter : kNamedFilters) {
- SkMatrix m;
- m.setIDiv(kS, kS);
- sk_sp<GrFragmentProcessor> fp(GrSimpleTextureEffect::Make(texture.get(), nullptr, m,
+ sk_sp<GrFragmentProcessor> fp(GrSimpleTextureEffect::Make(texture.get(), nullptr,
+ SkMatrix::I(),
filter.fMode));
REPORTER_ASSERT(reporter, fp);
if (!fp) {
diff --git a/tests/RectangleTextureTest.cpp b/tests/RectangleTextureTest.cpp
index a0c5409142..6d075df203 100644
--- a/tests/RectangleTextureTest.cpp
+++ b/tests/RectangleTextureTest.cpp
@@ -107,14 +107,12 @@ static void test_basic_draw(skiatest::Reporter* reporter, GrContext* context,
context->makeRenderTargetContext(SkBackingFit::kExact, rectangleTexture->width(),
rectangleTexture->height(), rectangleTexture->config(),
nullptr));
- SkMatrix m;
- m.setIDiv(rectangleTexture->width(), rectangleTexture->height());
for (auto filter : {GrSamplerParams::kNone_FilterMode,
GrSamplerParams::kBilerp_FilterMode,
GrSamplerParams::kMipMap_FilterMode}) {
rtContext->clear(nullptr, 0xDDCCBBAA, true);
- sk_sp<GrFragmentProcessor> fp(GrSimpleTextureEffect::Make(rectangleTexture,
- nullptr, m, filter));
+ sk_sp<GrFragmentProcessor> fp(GrSimpleTextureEffect::Make(rectangleTexture, nullptr,
+ SkMatrix::I(), filter));
GrPaint paint;
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
paint.addColorFragmentProcessor(std::move(fp));
diff --git a/tests/SRGBMipMapTest.cpp b/tests/SRGBMipMapTest.cpp
index 79d86911ff..22d68903eb 100644
--- a/tests/SRGBMipMapTest.cpp
+++ b/tests/SRGBMipMapTest.cpp
@@ -132,7 +132,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SRGBMipMaps, reporter, ctxInfo) {
GrPaint paint;
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
GrSamplerParams mipMapParams(SkShader::kRepeat_TileMode, GrSamplerParams::kMipMap_FilterMode);
- paint.addColorTextureProcessor(texture.get(), nullptr, SkMatrix::MakeScale(0.5f), mipMapParams);
+ paint.addColorTextureProcessor(texture.get(), nullptr, SkMatrix::MakeScale(rtS), mipMapParams);
// 1) Draw texture to S32 surface (should generate/use sRGB mips)
paint.setGammaCorrect(true);