Stop BRD-decoding non-opaque to 565 sink
review.skia.org/34361 accidentally started attempting to decode images
with transparency to a 565 sink. BRD helpfully decodes to N32 instead,
rather than failing. We don't need to test this here, and it draws to a
565 sink, resulting in incorrect images in Gold.
Change-Id: I9585b2c0c4526e5f33667bd8f57003449e735372
Reviewed-on: https://skia-review.googlesource.com/35707
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp
index a862969..9eee2d2 100644
--- a/dm/DMSrcSink.cpp
+++ b/dm/DMSrcSink.cpp
@@ -152,6 +152,13 @@
return Error::Nonfatal(SkStringPrintf("Could not create brd for %s.", fPath.c_str()));
}
+ if (kRGB_565_SkColorType == colorType) {
+ auto recommendedCT = brd->computeOutputColorType(colorType);
+ if (recommendedCT != colorType) {
+ return Error::Nonfatal("Skip decoding non-opaque to 565.");
+ }
+ }
+
const uint32_t width = brd->width();
const uint32_t height = brd->height();
// Visually inspecting very small output images is not necessary.