Title: [96970] trunk
Revision
96970
Author
[email protected]
Date
2011-10-07 12:26:47 -0700 (Fri, 07 Oct 2011)

Log Message

Source/WebCore: Enable color profiles, unless profile is grayscale
https://bugs.webkit.org/show_bug.cgi?id=69622
https://bugs.webkit.org/show_bug.cgi?id=49950
http://code.google.com/p/chromium/issues/detail?id=80844

Further specialize the earlier fix described in 49950 to
allow color profiles in YCbCr images, but disallow color
profiles marked as grayData.
(see http://www.color.org/ICC1v42_2006-05.pdf 7.2.6 )

Reviewed by Adam Barth.

Test: fast/images/gray-scale-jpeg-with-color-profile.html
      fast/images/color-jpeg-with-color-profile.html

* platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
(WebCore::readColorProfile):
(WebCore::JPEGImageReader::decode):

LayoutTests: Reviewed by Adam Barth.

Add a image with a color profile that's not gray.
https://bugs.webkit.org/show_bug.cgi?id=69622

Test that we properly render JPEGs with embedded non-gray color profiles.

* fast/images/color-jpeg-with-color-profile.html: Added.
* fast/images/resources/icc-v2-gbr.jpg: Added.
* platform/chromium-mac/fast/images/color-jpeg-with-color-profile-expected.txt: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (96969 => 96970)


--- trunk/LayoutTests/ChangeLog	2011-10-07 19:25:00 UTC (rev 96969)
+++ trunk/LayoutTests/ChangeLog	2011-10-07 19:26:47 UTC (rev 96970)
@@ -1,3 +1,16 @@
+2011-10-07  Cary Clark  <[email protected]>
+
+        Reviewed by Adam Barth.
+
+        Add a image with a color profile that's not gray.
+        https://bugs.webkit.org/show_bug.cgi?id=69622
+
+        Test that we properly render JPEGs with embedded non-gray color profiles.
+
+        * fast/images/color-jpeg-with-color-profile.html: Added.
+        * fast/images/resources/icc-v2-gbr.jpg: Added.
+        * platform/chromium-mac/fast/images/color-jpeg-with-color-profile-expected.txt: Added.
+
 2011-10-07  Sheriff Bot  <[email protected]>
 
         Unreviewed, rolling out r96938.

Added: trunk/LayoutTests/fast/images/color-jpeg-with-color-profile.html (0 => 96970)


--- trunk/LayoutTests/fast/images/color-jpeg-with-color-profile.html	                        (rev 0)
+++ trunk/LayoutTests/fast/images/color-jpeg-with-color-profile.html	2011-10-07 19:26:47 UTC (rev 96970)
@@ -0,0 +1 @@
+<img src=""

Added: trunk/LayoutTests/fast/images/resources/icc-v2-gbr.jpg


(Binary files differ)
Property changes on: trunk/LayoutTests/fast/images/resources/icc-v2-gbr.jpg ___________________________________________________________________

Added: svn:mime-type

Added: trunk/LayoutTests/platform/chromium-mac/fast/images/color-jpeg-with-color-profile-expected.txt (0 => 96970)


--- trunk/LayoutTests/platform/chromium-mac/fast/images/color-jpeg-with-color-profile-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/chromium-mac/fast/images/color-jpeg-with-color-profile-expected.txt	2011-10-07 19:26:47 UTC (rev 96970)
@@ -0,0 +1,7 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderImage {IMG} at (0,0) size 275x207
+      RenderText {#text} at (0,0) size 0x0

Modified: trunk/Source/WebCore/ChangeLog (96969 => 96970)


--- trunk/Source/WebCore/ChangeLog	2011-10-07 19:25:00 UTC (rev 96969)
+++ trunk/Source/WebCore/ChangeLog	2011-10-07 19:26:47 UTC (rev 96970)
@@ -1,3 +1,24 @@
+2011-10-07  Cary Clark  <[email protected]>
+
+        Enable color profiles, unless profile is grayscale
+        https://bugs.webkit.org/show_bug.cgi?id=69622
+        https://bugs.webkit.org/show_bug.cgi?id=49950
+        http://code.google.com/p/chromium/issues/detail?id=80844
+
+        Further specialize the earlier fix described in 49950 to
+        allow color profiles in YCbCr images, but disallow color
+        profiles marked as grayData.
+        (see http://www.color.org/ICC1v42_2006-05.pdf 7.2.6 )
+
+        Reviewed by Adam Barth.
+
+        Test: fast/images/gray-scale-jpeg-with-color-profile.html
+              fast/images/color-jpeg-with-color-profile.html
+
+        * platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
+        (WebCore::readColorProfile):
+        (WebCore::JPEGImageReader::decode):
+
 2011-10-07  Chris Fleizach  <[email protected]>
 
         AX: re-organize fake elements to use new AccessibilityMockObject
@@ -8293,7 +8314,6 @@
         * bridge/qt/qt_runtime.h:
         * workers/WorkerContext.h:
 
-<<<<<<< .mine
 2011-09-27  Mark Hahnenberg  <[email protected]>
 
         Add static version of JSCell::getCallData
@@ -8359,7 +8379,6 @@
         (JSC::Bindings::RuntimeObject::getCallData):
         * bridge/runtime_object.h:
 
-=======
 2011-09-27  Dean Jackson  <[email protected]>
 
         Unreviewed. Remove duplicate FilterOperation{s}.h that were
@@ -8367,7 +8386,6 @@
 
         * WebCore.xcodeproj/project.pbxproj:
 
->>>>>>> .r96163
 2011-09-27  David Hyatt  <[email protected]>
 
         https://bugs.webkit.org/show_bug.cgi?id=68940

Modified: trunk/Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp (96969 => 96970)


--- trunk/Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp	2011-10-07 19:25:00 UTC (rev 96969)
+++ trunk/Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp	2011-10-07 19:26:47 UTC (rev 96970)
@@ -101,9 +101,17 @@
 
     if (!read_icc_profile(info, &profile, &profileLength))
         return ColorProfile();
+    char* profileData = reinterpret_cast<char*>(profile);
+    // Images with grayscale profiles get "upsampled" by libjpeg. If we use
+    // their color profile, CoreGraphics will "upsample" them
+    // again, resulting in horizontal distortions.
+    if (profileLength >= 20 && !memcmp(&profileData[16], "GRAY", 4)) {
+        free(profile);
+        return ColorProfile();
+    }
 
     ColorProfile colorProfile;
-    colorProfile.append(reinterpret_cast<char*>(profile), profileLength);
+    colorProfile.append(profileData, profileLength);
     free(profile);
     return colorProfile;
 #else
@@ -209,12 +217,12 @@
             // Let libjpeg take care of gray->RGB and YCbCr->RGB conversions.
             switch (m_info.jpeg_color_space) {
             case JCS_GRAYSCALE:
-            case JCS_YCbCr:
                 // Grayscale images get "upsampled" by libjpeg.  If we use
                 // their color profile, CoreGraphics will "upsample" them
                 // again, resulting in horizontal distortions.
                 m_decoder->setIgnoreGammaAndColorProfile(true);
                 // Note fall-through!
+            case JCS_YCbCr:
             case JCS_RGB:
                 m_info.out_color_space = JCS_RGB;
                 break;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to