2009-02-27  Adam Treat  <adam.treat@torchmobile.com>

        Reviewed by Eric Seidel.

        https://bugs.webkit.org/show_bug.cgi?id=24229
        If an image has no alpha channel there is no reason to use SourceOver.

        * platform/graphics/qt/ImageQt.cpp:
        (WebCore::Image::drawPattern):
        (WebCore::BitmapImage::draw):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@41296 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 58959bc..5d4ced7 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,5 +1,16 @@
 2009-02-27  Adam Treat  <adam.treat@torchmobile.com>
 
+        Reviewed by Eric Seidel.
+
+        https://bugs.webkit.org/show_bug.cgi?id=24229
+        If an image has no alpha channel there is no reason to use SourceOver.
+
+        * platform/graphics/qt/ImageQt.cpp:
+        (WebCore::Image::drawPattern):
+        (WebCore::BitmapImage::draw):
+
+2009-02-27  Adam Treat  <adam.treat@torchmobile.com>
+
         Reviewed by Eric Seidel and Simon Fraser.
 
         https://bugs.webkit.org/show_bug.cgi?id=24227
diff --git a/WebCore/platform/graphics/qt/ImageQt.cpp b/WebCore/platform/graphics/qt/ImageQt.cpp
index 06e3a81..5898daa 100644
--- a/WebCore/platform/graphics/qt/ImageQt.cpp
+++ b/WebCore/platform/graphics/qt/ImageQt.cpp
@@ -112,6 +112,8 @@
     ctxt->save();
     ctxt->setCompositeOperation(op);
     QPainter* p = ctxt->platformContext();
+    if (!pixmap.hasAlpha() && p->compositionMode() == QPainter::CompositionMode_SourceOver)
+        p->setCompositionMode(QPainter::CompositionMode_Source);
     p->setBrushOrigin(phase);
     p->fillRect(destRect, b);
     ctxt->restore();
@@ -149,6 +151,9 @@
 
     QPainter* painter(ctxt->platformContext());
 
+    if (!image->hasAlpha() && painter->compositionMode() == QPainter::CompositionMode_SourceOver)
+        painter->setCompositionMode(QPainter::CompositionMode_Source);
+
     // Test using example site at
     // http://www.meyerweb.com/eric/css/edge/complexspiral/demo.html    
     painter->drawPixmap(dst, *image, src);