aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/AnimatedImageTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/AnimatedImageTest.cpp')
-rw-r--r--tests/AnimatedImageTest.cpp17
1 files changed, 14 insertions, 3 deletions
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<sk_sp<SkPicture>> 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<SkAnimatedImage>& animatedImage,
int expectedFrame) {
SkBitmap test;
- test.allocPixels(imageInfo);
+ test.allocPixels(temporarily_sanitize(imageInfo));
test.eraseColor(0);
SkCanvas c(test);
animatedImage->draw(&c);