diff options
author | Leon Scroggins III <scroggo@google.com> | 2018-03-13 11:14:33 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-03-13 15:42:52 +0000 |
commit | 0118e9756d92d3c56b9e05842d7c828f37f68159 (patch) | |
tree | abba2299d13bf90f0898df166bbf5afa605edea7 /dm/DMSrcSink.cpp | |
parent | 15a68c4365be9f76041e5f12ad7d984b341f7c93 (diff) |
Remove calls to computeOutputColor- Type and Space
Bug: b/70846442
Test: I5110881203c000474116a94a48f2afc9a9b62001
These methods were already called by the client. The client may have
further overridden the SkColorType (and therefore the SkColorSpace), so
respect their final decision on both.
Change-Id: Iddcf618e474784b0a000fd516250c44285dacc6b
Reviewed-on: https://skia-review.googlesource.com/114062
Commit-Queue: Leon Scroggins <scroggo@google.com>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Diffstat (limited to 'dm/DMSrcSink.cpp')
-rw-r--r-- | dm/DMSrcSink.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp index 9f7814f21f..26698bf56a 100644 --- a/dm/DMSrcSink.cpp +++ b/dm/DMSrcSink.cpp @@ -170,12 +170,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."); - } + auto recommendedCT = brd->computeOutputColorType(colorType); + if (kRGB_565_SkColorType == colorType && recommendedCT != colorType) { + return Error::Nonfatal("Skip decoding non-opaque to 565."); } + colorType = recommendedCT; + + auto colorSpace = brd->computeOutputColorSpace(colorType, nullptr); const uint32_t width = brd->width(); const uint32_t height = brd->height(); @@ -187,7 +188,7 @@ Error BRDSrc::draw(SkCanvas* canvas) const { case kFullImage_Mode: { SkBitmap bitmap; if (!brd->decodeRegion(&bitmap, nullptr, SkIRect::MakeXYWH(0, 0, width, height), - fSampleSize, colorType, false, SkColorSpace::MakeSRGB())) { + fSampleSize, colorType, false, colorSpace)) { return "Cannot decode (full) region."; } alpha8_to_gray8(&bitmap); @@ -243,7 +244,7 @@ Error BRDSrc::draw(SkCanvas* canvas) const { SkBitmap bitmap; if (!brd->decodeRegion(&bitmap, nullptr, SkIRect::MakeXYWH(decodeLeft, decodeTop, decodeWidth, decodeHeight), fSampleSize, colorType, false, - SkColorSpace::MakeSRGB())) { + colorSpace)) { return "Cannot decode region."; } |