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

Unified Diff: third_party/WebKit/Source/platform/image-decoders/jpeg/JPEGImageDecoder.cpp

Issue 2942873002: Fix the color issue in CMYK jpeg images.
Patch Set: Created 3 years, 6 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
Index: third_party/WebKit/Source/platform/image-decoders/jpeg/JPEGImageDecoder.cpp
diff --git a/third_party/WebKit/Source/platform/image-decoders/jpeg/JPEGImageDecoder.cpp b/third_party/WebKit/Source/platform/image-decoders/jpeg/JPEGImageDecoder.cpp
index 7e2aea53f3404b413f3a986dbc46d62d5995a37d..58866a97007e54bb9632ddf17bd2414b5f3fdb96 100644
--- a/third_party/WebKit/Source/platform/image-decoders/jpeg/JPEGImageDecoder.cpp
+++ b/third_party/WebKit/Source/platform/image-decoders/jpeg/JPEGImageDecoder.cpp
@@ -453,8 +453,15 @@ class JPEGImageReader final {
JOCTET* profile = nullptr;
unsigned profile_length = 0;
if (read_icc_profile(Info(), &profile, &profile_length)) {
+ // Default set to ICC type to RGB
+ SkColorSpace::ICCTypeFlag icc_type = SkColorSpace::kRGB_ICCTypeFlag;
+
+ // Update ICC type to CMYK JPEG image
+ if (info_.out_color_space == JCS_CMYK)
+ icc_type = SkColorSpace::kCMYK_ICCTypeFlag;
+
Decoder()->SetEmbeddedColorProfile(reinterpret_cast<char*>(profile),
- profile_length);
+ profile_length, icc_type);
free(profile);
}
if (Decoder()->ColorTransform()) {
@@ -850,7 +857,7 @@ bool OutputRows(JPEGImageReader* reader, ImageFrame& buffer) {
SetPixel<colorSpace>(pixel, samples, x);
SkColorSpaceXform* xform = reader->Decoder()->ColorTransform();
- if (JCS_RGB == colorSpace && xform) {
+ if (xform) {
ImageFrame::PixelData* row = buffer.GetAddr(0, y);
xform->apply(XformColorFormat(), row, XformColorFormat(), row, width,
kOpaque_SkAlphaType);

Powered by Google App Engine
This is Rietveld 408576698