Title: [118980] trunk/Source/WebCore
- Revision
- 118980
- Author
- [email protected]
- Date
- 2012-05-30 15:08:56 -0700 (Wed, 30 May 2012)
Log Message
[Qt] ImageDecoderQt doesn't support some decoders.
https://bugs.webkit.org/show_bug.cgi?id=87851
Patch by Allan Sandfeld Jensen <[email protected]> on 2012-05-30
Reviewed by Kenneth Rohde Christiansen.
If forced to decode GIF and JPEG, ImageDecoderQt show several
artifacts. This is caused by mismatched decoded image-formats.
Convert mismatched color spaces into ARGB color space, and perform
manual mem-copy when the image has been decoded into a new buffer.
This patch also add support for down-scaling in the decoder.
* platform/graphics/qt/ImageDecoderQt.cpp:
(WebCore::ImageDecoderQt::internalDecodeSize):
(WebCore::ImageDecoderQt::internalHandleCurrentImage):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (118979 => 118980)
--- trunk/Source/WebCore/ChangeLog 2012-05-30 21:58:59 UTC (rev 118979)
+++ trunk/Source/WebCore/ChangeLog 2012-05-30 22:08:56 UTC (rev 118980)
@@ -1,3 +1,22 @@
+2012-05-30 Allan Sandfeld Jensen <[email protected]>
+
+ [Qt] ImageDecoderQt doesn't support some decoders.
+ https://bugs.webkit.org/show_bug.cgi?id=87851
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ If forced to decode GIF and JPEG, ImageDecoderQt show several
+ artifacts. This is caused by mismatched decoded image-formats.
+
+ Convert mismatched color spaces into ARGB color space, and perform
+ manual mem-copy when the image has been decoded into a new buffer.
+
+ This patch also add support for down-scaling in the decoder.
+
+ * platform/graphics/qt/ImageDecoderQt.cpp:
+ (WebCore::ImageDecoderQt::internalDecodeSize):
+ (WebCore::ImageDecoderQt::internalHandleCurrentImage):
+
2012-05-30 Emil A Eklund <[email protected]>
Floats wraps incorrectly when top edge has subpixel precision
Modified: trunk/Source/WebCore/platform/graphics/qt/ImageDecoderQt.cpp (118979 => 118980)
--- trunk/Source/WebCore/platform/graphics/qt/ImageDecoderQt.cpp 2012-05-30 21:58:59 UTC (rev 118979)
+++ trunk/Source/WebCore/platform/graphics/qt/ImageDecoderQt.cpp 2012-05-30 22:08:56 UTC (rev 118980)
@@ -156,6 +156,12 @@
}
setSize(size.width(), size.height());
+
+ // We don't need the tables set by prepareScaleDataIfNecessary,
+ // but their dimensions are used by ImageDecoder::scaledSize().
+ prepareScaleDataIfNecessary();
+ if (m_scaled)
+ m_reader->setScaledSize(scaledSize());
}
void ImageDecoderQt::internalReadImage(size_t frameIndex)
@@ -184,7 +190,9 @@
bool ImageDecoderQt::internalHandleCurrentImage(size_t frameIndex)
{
ImageFrame* const buffer = &m_frameBufferCache[frameIndex];
- QSize imageSize = m_reader->size();
+ QSize imageSize = m_reader->scaledSize();
+ if (imageSize.isEmpty())
+ imageSize = m_reader->size();
if (!buffer->setSize(imageSize.width(), imageSize.height()))
return false;
@@ -194,6 +202,20 @@
buffer->setDuration(m_reader->nextImageDelay());
m_reader->read(&image);
+ // ImageFrame expects ARGB32.
+ if (buffer->premultiplyAlpha()) {
+ if (image.format() != QImage::Format_ARGB32_Premultiplied)
+ image = image.convertToFormat(QImage::Format_ARGB32_Premultiplied);
+ } else {
+ if (image.format() != QImage::Format_ARGB32)
+ image = image.convertToFormat(QImage::Format_ARGB32);
+ }
+
+ if (reinterpret_cast<const uchar*>(image.constBits()) != reinterpret_cast<const uchar*>(buffer->getAddr(0, 0))) {
+ // The in-buffer was replaced during decoding with another, so copy into it manually.
+ memcpy(buffer->getAddr(0, 0), image.constBits(), image.byteCount());
+ }
+
if (image.isNull()) {
frameCount();
repetitionCount();
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes