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

Unified Diff: dm/DMSrcSink.cpp

Issue 2184543003: Perform color correction on png decodes (Closed) Base URL: https://skia.googlesource.com/skia.git@colorjpegs
Patch Set: Fixes Created 4 years, 4 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') | src/codec/SkCodecPriv.h » ('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 f4c8956b25505ad5f486baaeecb6eb6c6f50ee84..13c81f581d3b86170fa7d1e2243b5a488fa496b9 100644
--- a/dm/DMSrcSink.cpp
+++ b/dm/DMSrcSink.cpp
@@ -853,8 +853,15 @@ Error ColorCodecSrc::draw(SkCanvas* canvas) const {
return Error::Nonfatal("No need to test color correction to 565 backend.");
}
- if (nullptr == canvas->imageInfo().colorSpace() && kRGBA_F16_SkColorType == fColorType) {
- return Error::Nonfatal("F16 does not draw in legacy mode.");
+ bool runInLegacyMode = kBaseline_Mode == fMode;
+#if defined(SK_TEST_QCMS)
+ runInLegacyMode = runInLegacyMode || kQCMS_HPZR30w_Mode == fMode;
+#endif
+
+ if (runInLegacyMode && canvas->imageInfo().colorSpace()) {
+ return Error::Nonfatal("Skipping tests that are only interesting in legacy mode.");
+ } else if (!runInLegacyMode && !canvas->imageInfo().colorSpace()) {
+ return Error::Nonfatal("Skipping tests that are only interesting in srgb mode.");
}
SkAutoTUnref<SkData> encoded(SkData::NewFromFileName(fPath.c_str()));
@@ -882,6 +889,10 @@ Error ColorCodecSrc::draw(SkCanvas* canvas) const {
}
SkImageInfo decodeInfo = codec->getInfo().makeColorType(fColorType).makeColorSpace(dstSpace);
+ if (kUnpremul_SkAlphaType == decodeInfo.alphaType()) {
+ decodeInfo = decodeInfo.makeAlphaType(kPremul_SkAlphaType);
+ }
+
SkImageInfo bitmapInfo = decodeInfo;
if (kRGBA_8888_SkColorType == decodeInfo.colorType() ||
kBGRA_8888_SkColorType == decodeInfo.colorType())
@@ -910,6 +921,10 @@ Error ColorCodecSrc::draw(SkCanvas* canvas) const {
#if defined(SK_TEST_QCMS)
case kQCMS_HPZR30w_Mode: {
sk_sp<SkData> srcData = codec->getICCData();
+ if (!srcData) {
+ return Error::Nonfatal("No ICC profile data. Cannot test with QCMS.\n");
+ }
+
SkAutoTCallVProc<qcms_profile, qcms_profile_release>
srcSpace(qcms_profile_from_memory(srcData->data(), srcData->size()));
if (!srcSpace) {
« no previous file with comments | « bench/ColorCodecBench.cpp ('k') | src/codec/SkCodecPriv.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698