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>
This commit is contained in:
Leon Scroggins III 2017-08-17 13:42:48 -04:00 committed by Skia Commit-Bot
parent 8ab8f61c4e
commit 1dc8ecbf5f

View File

@ -152,6 +152,13 @@ Error BRDSrc::draw(SkCanvas* canvas) const {
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.