[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
abarth at webkit.org
abarth at webkit.org
Wed Dec 22 15:24:28 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 247a3aa24ce46e54292092c8fc66a738a8122bac
Author: abarth at webkit.org <abarth at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Nov 2 22:01:32 2010 +0000
2010-11-02 Adam Barth <abarth at webkit.org>
Reviewed by Eric Seidel.
JPEG decoders should understand color profiles
https://bugs.webkit.org/show_bug.cgi?id=48819
This patch is currently a no-op because no one defines USE(ICCJPEG).
We'll enable this for Chromium Mac once we have ICCJPEG landed in
Chromium's third_party directory.
* platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
(WebCore::readColorProfile):
(WebCore::JPEGImageReader::JPEGImageReader):
(WebCore::JPEGImageReader::decode):
(WebCore::JPEGImageDecoder::outputScanlines):
* platform/image-decoders/jpeg/JPEGImageDecoder.h:
(WebCore::JPEGImageDecoder::setColorProfile):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@71174 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index e08773b..48e64d6 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,22 @@
+2010-11-02 Adam Barth <abarth at webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ JPEG decoders should understand color profiles
+ https://bugs.webkit.org/show_bug.cgi?id=48819
+
+ This patch is currently a no-op because no one defines USE(ICCJPEG).
+ We'll enable this for Chromium Mac once we have ICCJPEG landed in
+ Chromium's third_party directory.
+
+ * platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
+ (WebCore::readColorProfile):
+ (WebCore::JPEGImageReader::JPEGImageReader):
+ (WebCore::JPEGImageReader::decode):
+ (WebCore::JPEGImageDecoder::outputScanlines):
+ * platform/image-decoders/jpeg/JPEGImageDecoder.h:
+ (WebCore::JPEGImageDecoder::setColorProfile):
+
2010-11-02 Mihai Parparita <mihaip at chromium.org>
Reviewed by Adam Barth.
diff --git a/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp b/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp
index 6c6c782..da35739 100644
--- a/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp
+++ b/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp
@@ -51,7 +51,13 @@
#endif
extern "C" {
+
#include "jpeglib.h"
+
+#if USE(ICCJPEG)
+#include "iccjpeg.h"
+#endif
+
}
#include <setjmp.h>
@@ -86,6 +92,24 @@ struct decoder_source_mgr {
JPEGImageReader* decoder;
};
+static ColorProfile readColorProfile(jpeg_decompress_struct* info)
+{
+#if USE(ICCJPEG)
+ JOCTET* profile;
+ unsigned int profileLength;
+
+ if (!read_icc_profile(info, &profile, &profileLength))
+ return ColorProfile();
+
+ ColorProfile colorProfile;
+ colorProfile.append(reinterpret_cast<char*>(profile), profileLength);
+ free(profile);
+ return colorProfile;
+#else
+ return ColorProfile();
+#endif
+}
+
class JPEGImageReader
{
public:
@@ -123,6 +147,11 @@ public:
src->pub.resync_to_restart = jpeg_resync_to_restart;
src->pub.term_source = term_source;
src->decoder = this;
+
+ // Enable these markers for the ICC color profile.
+ // Apparently there are 16 of these markers. I don't see anywhere in the header with this constant.
+ for (unsigned i = 0; i < 0xF; ++i)
+ jpeg_save_markers(&m_info, JPEG_APP0 + i, 0xFFFF);
}
~JPEGImageReader()
@@ -212,6 +241,8 @@ public:
if (!m_decoder->setSize(m_info.image_width, m_info.image_height))
return false;
+ m_decoder->setColorProfile(readColorProfile(info()));
+
if (m_decodingSizeOnly) {
// We can stop here. Reduce our buffer length and available
// data.
@@ -421,6 +452,7 @@ bool JPEGImageDecoder::outputScanlines()
return setFailed();
buffer.setStatus(RGBA32Buffer::FramePartial);
buffer.setHasAlpha(false);
+ buffer.setColorProfile(m_colorProfile);
// For JPEGs, the frame always fills the entire image.
buffer.setRect(IntRect(IntPoint(), size()));
diff --git a/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.h b/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.h
index 5047019..e942b01 100644
--- a/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.h
+++ b/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.h
@@ -54,6 +54,8 @@ namespace WebCore {
bool outputScanlines();
void jpegComplete();
+ void setColorProfile(const ColorProfile& colorProfile) { m_colorProfile = colorProfile; }
+
private:
// Decodes the image. If |onlySize| is true, stops decoding after
// calculating the image size. If decoding fails but there is no more
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list