2010-06-02  Qi Zhang  <qi.2.zhang@nokia.com>

        Reviewed by Dirk Schulze.

        [Qt] Image shadow doesn't work
        https://bugs.webkit.org/show_bug.cgi?id=37804

        Enable image shadow basic test and disable image shadow transparent test case, that failed
        because of the Qt known issue on transparent image.

        * platform/qt/Skipped:
2010-06-02  Qi Zhang  <qi.2.zhang@nokia.com>

        Reviewed by Dirk Schulze.

        [Qt] Image shadow doesn't work
        https://bugs.webkit.org/show_bug.cgi?id=37804

        Implement the code for image shadow

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

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@60546 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/platform/graphics/qt/ImageQt.cpp b/WebCore/platform/graphics/qt/ImageQt.cpp
index db12738..970f4ad 100644
--- a/WebCore/platform/graphics/qt/ImageQt.cpp
+++ b/WebCore/platform/graphics/qt/ImageQt.cpp
@@ -187,6 +187,23 @@
     if (!image->hasAlpha() && painter->compositionMode() == QPainter::CompositionMode_SourceOver)
         painter->setCompositionMode(QPainter::CompositionMode_Source);
 
+    IntSize shadowSize;
+    int shadowBlur;
+    Color shadowColor;
+    if (ctxt->getShadow(shadowSize, shadowBlur, shadowColor)) {
+        FloatRect shadowImageRect(dst);
+        shadowImageRect.move(shadowSize.width(), shadowSize.height());
+
+        QImage shadowImage(QSize(static_cast<int>(src.width()), static_cast<int>(src.height())), QImage::Format_ARGB32_Premultiplied);
+        QPainter p(&shadowImage);
+        p.setCompositionMode(QPainter::CompositionMode_Source);
+        p.fillRect(shadowImage.rect(), shadowColor);
+        p.setCompositionMode(QPainter::CompositionMode_DestinationIn);
+        p.drawPixmap(dst, *image, src);
+        p.end();
+        painter->drawImage(shadowImageRect, shadowImage, src);
+    }
+
     // Test using example site at
     // http://www.meyerweb.com/eric/css/edge/complexspiral/demo.html
     painter->drawPixmap(dst, *image, src);