Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2375)

Unified Diff: dm/DMSrcSink.cpp

Issue 2389983002: Refactored SkColorSpace and added in a Lab PCS GM (Closed)
Patch Set: migrated call from SkColorSpace_Base::makeLinearGamma() to SkColorSpace_XYZ::makeLinearGamma() Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « bench/ColorCodecBench.cpp ('k') | gm/gamut.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dm/DMSrcSink.cpp
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp
index e777815baabce71bcf5ac20ad74e2721dd52eda2..8b62864c8f4a4018807309c5df439322929b3d60 100644
--- a/dm/DMSrcSink.cpp
+++ b/dm/DMSrcSink.cpp
@@ -11,7 +11,7 @@
#include "SkCodec.h"
#include "SkCodecImageGenerator.h"
#include "SkColorSpace.h"
-#include "SkColorSpace_Base.h"
+#include "SkColorSpace_XYZ.h"
#include "SkColorSpaceXform.h"
#include "SkCommonFlags.h"
#include "SkData.h"
@@ -920,7 +920,9 @@ Error ColorCodecSrc::draw(SkCanvas* canvas) const {
decodeInfo = decodeInfo.makeAlphaType(kPremul_SkAlphaType);
}
if (kRGBA_F16_SkColorType == fColorType) {
- decodeInfo = decodeInfo.makeColorSpace(as_CSB(decodeInfo.colorSpace())->makeLinearGamma());
+ SkASSERT(SkColorSpace_Base::Type::kXYZ == as_CSB(decodeInfo.colorSpace())->type());
+ SkColorSpace_XYZ* csXYZ = static_cast<SkColorSpace_XYZ*>(decodeInfo.colorSpace());
+ decodeInfo = decodeInfo.makeColorSpace(csXYZ->makeLinearGamma());
}
SkImageInfo bitmapInfo = decodeInfo;
@@ -939,7 +941,15 @@ Error ColorCodecSrc::draw(SkCanvas* canvas) const {
size_t rowBytes = bitmap.rowBytes();
SkCodec::Result r = codec->getPixels(decodeInfo, bitmap.getPixels(), rowBytes);
if (SkCodec::kSuccess != r && SkCodec::kIncompleteInput != r) {
- return SkStringPrintf("Couldn't getPixels %s. Error code %d", fPath.c_str(), r);
+ if (kRGBA_F16_SkColorType == decodeInfo.colorType()) {
+ // FIXME (raftias):
+ // Get the codecs to not fail when there is no color xform,
+ // which currently happens in F16 mode.
+ return Error::Nonfatal(SkStringPrintf("Couldn't getPixels %s in F16. Error code %d",
+ fPath.c_str()));
+ } else {
+ return SkStringPrintf("Couldn't getPixels %s. Error code %d", fPath.c_str(), r);
+ }
}
switch (fMode) {
« no previous file with comments | « bench/ColorCodecBench.cpp ('k') | gm/gamut.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698