From 6f02af9b54c28294363b5bde1f9c103fe0f054bc Mon Sep 17 00:00:00 2001 From: Mike Klein Date: Tue, 5 Jun 2018 15:11:11 -0400 Subject: remove linear-blended sRGB dst support in software This is the mechanism we'd want to add back if we add an sRGBA SkColorType. This will break the DM "srgb" config hard. Landing this first should help flush out GMs that are incidentally using sRGB offscreens. Updated tests/AnimatedImageTest.cpp to avoid linear sRGB 8888 surfaces. CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_trusty_blink_rel Change-Id: Idb5035cf4d60fcd1dc24c303d43a406fc4a603fa Reviewed-on: https://skia-review.googlesource.com/132261 Commit-Queue: Mike Klein Reviewed-by: Brian Osman --- tests/AnimatedImageTest.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'tests/AnimatedImageTest.cpp') diff --git a/tests/AnimatedImageTest.cpp b/tests/AnimatedImageTest.cpp index 13ea80804c..6532b58894 100644 --- a/tests/AnimatedImageTest.cpp +++ b/tests/AnimatedImageTest.cpp @@ -97,6 +97,17 @@ static bool compare_bitmaps(skiatest::Reporter* r, return true; } +// Temporary hack to avoid linear sRGB 8888 surfaces. +static SkImageInfo temporarily_sanitize(SkImageInfo info) { + if (info.colorType() == kRGBA_8888_SkColorType || + info.colorType() == kBGRA_8888_SkColorType) { + if (info.colorSpace() && info.colorSpace()->isSRGB()) { + info = info.makeColorSpace(nullptr); + } + } + return info; +} + DEF_TEST(AnimatedImage_copyOnWrite, r) { if (GetResourcePath().isEmpty()) { return; @@ -137,7 +148,7 @@ DEF_TEST(AnimatedImage_copyOnWrite, r) { std::vector> pictures(frameCount); for (int i = 0; i < frameCount; i++) { SkBitmap& bm = expected[i]; - bm.allocPixels(imageInfo); + bm.allocPixels(temporarily_sanitize(imageInfo)); bm.eraseColor(SK_ColorTRANSPARENT); SkCanvas canvas(bm); @@ -157,7 +168,7 @@ DEF_TEST(AnimatedImage_copyOnWrite, r) { for (int i = 0; i < frameCount; i++) { SkBitmap test; - test.allocPixels(imageInfo); + test.allocPixels(temporarily_sanitize(imageInfo)); test.eraseColor(SK_ColorTRANSPARENT); SkCanvas canvas(test); @@ -237,7 +248,7 @@ DEF_TEST(AnimatedImage, r) { auto testDraw = [r, &frames, &imageInfo, file](const sk_sp& animatedImage, int expectedFrame) { SkBitmap test; - test.allocPixels(imageInfo); + test.allocPixels(temporarily_sanitize(imageInfo)); test.eraseColor(0); SkCanvas c(test); animatedImage->draw(&c); -- cgit v1.2.3