[Qt] Support IMAGE_DECODER_DOWN_SAMPLING flag.
https://bugs.webkit.org/show_bug.cgi?id=87840
Based on patches by Qi Zhang and Jussi Lehto.
Patch by Allan Sandfeld Jensen <allan.jensen@nokia.com> on 2012-05-30
Reviewed by Kenneth Rohde Christiansen.
* platform/graphics/Image.cpp:
(WebCore::Image::adjustSourceRectForDownSampling):
* platform/graphics/Image.h:
(Image):
* platform/graphics/openvg/ImageOpenVG.cpp:
(WebCore::BitmapImage::draw):
* platform/graphics/qt/ImageQt.cpp:
(WebCore::Image::drawPattern):
(WebCore::BitmapImage::draw):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@118947 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/platform/graphics/qt/ImageQt.cpp b/Source/WebCore/platform/graphics/qt/ImageQt.cpp
index 182b366..849435f 100644
--- a/Source/WebCore/platform/graphics/qt/ImageQt.cpp
+++ b/Source/WebCore/platform/graphics/qt/ImageQt.cpp
@@ -132,9 +132,15 @@
if (!framePixmap) // If it's too early we won't have an image yet.
return;
+#if ENABLE(IMAGE_DECODER_DOWN_SAMPLING)
+ FloatRect tileRectAdjusted = adjustSourceRectForDownSampling(tileRect, framePixmap->size());
+#else
+ FloatRect tileRectAdjusted = tileRect;
+#endif
+
// Qt interprets 0 width/height as full width/height so just short circuit.
QRectF dr = QRectF(destRect).normalized();
- QRect tr = QRectF(tileRect).toRect().normalized();
+ QRect tr = QRectF(tileRectAdjusted).toRect().normalized();
if (!dr.width() || !dr.height() || !tr.width() || !tr.height())
return;
@@ -239,6 +245,10 @@
return;
}
+#if ENABLE(IMAGE_DECODER_DOWN_SAMPLING)
+ normalizedSrc = adjustSourceRectForDownSampling(normalizedSrc, image->size());
+#endif
+
CompositeOperator previousOperator = ctxt->compositeOperation();
ctxt->setCompositeOperation(!image->hasAlpha() && op == CompositeSourceOver ? CompositeCopy : op);