[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198

andreas.kling at nokia.com andreas.kling at nokia.com
Sun Feb 20 23:36:28 UTC 2011


The following commit has been merged in the webkit-1.3 branch:
commit bbef9f5394d6e36b955d4f01f2543b2151d0b851
Author: andreas.kling at nokia.com <andreas.kling at nokia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sat Jan 22 01:45:14 2011 +0000

    2011-01-21  Andreas Kling  <kling at webkit.org>
    
            Reviewed by Kenneth Rohde Christiansen.
    
            [Qt] Always set composition mode through GraphicsContext
            https://bugs.webkit.org/show_bug.cgi?id=52940
    
            GraphicsContext tracks the current composition mode so we should
            never call through to the QPainter directly.
    
            * platform/graphics/GraphicsContext.h:
            * platform/graphics/qt/GraphicsContextQt.cpp:
            (WebCore::toQtCompositionMode): Changed this method to a static inline
            since it's only used by GraphicsContextQt.cpp now.
    
            * platform/graphics/qt/ImageQt.cpp:
            (WebCore::Image::drawPattern):
            (WebCore::BitmapImage::draw):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76415 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index ab35d57..3cded15 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,22 @@
+2011-01-21  Andreas Kling  <kling at webkit.org>
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        [Qt] Always set composition mode through GraphicsContext
+        https://bugs.webkit.org/show_bug.cgi?id=52940
+
+        GraphicsContext tracks the current composition mode so we should
+        never call through to the QPainter directly.
+
+        * platform/graphics/GraphicsContext.h:
+        * platform/graphics/qt/GraphicsContextQt.cpp:
+        (WebCore::toQtCompositionMode): Changed this method to a static inline
+        since it's only used by GraphicsContextQt.cpp now.
+
+        * platform/graphics/qt/ImageQt.cpp:
+        (WebCore::Image::drawPattern):
+        (WebCore::BitmapImage::draw):
+
 2011-01-21  Dan Bernstein  <mitz at apple.com>
 
         Reviewed by Adele Peterson.
diff --git a/Source/WebCore/platform/graphics/GraphicsContext.h b/Source/WebCore/platform/graphics/GraphicsContext.h
index 35824dc..6d6c043 100644
--- a/Source/WebCore/platform/graphics/GraphicsContext.h
+++ b/Source/WebCore/platform/graphics/GraphicsContext.h
@@ -465,7 +465,6 @@ namespace WebCore {
         bool inTransparencyLayer() const;
         void pushTransparencyLayerInternal(const QRect &rect, qreal opacity, QPixmap& alphaMask);
         void takeOwnershipOfPlatformContext();
-        static QPainter::CompositionMode toQtCompositionMode(CompositeOperator op);
 #endif
 
 #if PLATFORM(QT) || PLATFORM(CAIRO)
diff --git a/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp b/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
index 4dabe09..87cc87c 100644
--- a/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
+++ b/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
@@ -69,7 +69,7 @@
 
 namespace WebCore {
 
-QPainter::CompositionMode GraphicsContext::toQtCompositionMode(CompositeOperator op)
+static inline QPainter::CompositionMode toQtCompositionMode(CompositeOperator op)
 {
     switch (op) {
     case CompositeClear:
diff --git a/Source/WebCore/platform/graphics/qt/ImageQt.cpp b/Source/WebCore/platform/graphics/qt/ImageQt.cpp
index 58f82ef..0c8ce9e 100644
--- a/Source/WebCore/platform/graphics/qt/ImageQt.cpp
+++ b/Source/WebCore/platform/graphics/qt/ImageQt.cpp
@@ -120,11 +120,9 @@ void Image::drawPattern(GraphicsContext* ctxt, const FloatRect& tileRect, const
 
     CompositeOperator previousOperator = ctxt->compositeOperation();
 
-    ctxt->setCompositeOperation(op);
-    QPainter* p = ctxt->platformContext();
-    if (!pixmap.hasAlpha() && p->compositionMode() == QPainter::CompositionMode_SourceOver)
-        p->setCompositionMode(QPainter::CompositionMode_Source);
+    ctxt->setCompositeOperation(!pixmap.hasAlpha() && op == CompositeSourceOver ? CompositeCopy : op);
 
+    QPainter* p = ctxt->platformContext();
     QTransform transform(patternTransform);
 
     // If this would draw more than one scaled tile, we scale the pixmap first and then use the result to draw.
@@ -223,15 +221,8 @@ void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dst,
         return;
     }
 
-    QPainter* painter(ctxt->platformContext());
-
-    QPainter::CompositionMode compositionMode = GraphicsContext::toQtCompositionMode(op);
-
-    if (!image->hasAlpha() && painter->compositionMode() == QPainter::CompositionMode_SourceOver)
-        compositionMode = QPainter::CompositionMode_Source;
-
-    QPainter::CompositionMode lastCompositionMode = painter->compositionMode();
-    painter->setCompositionMode(compositionMode);
+    CompositeOperator previousOperator = ctxt->compositeOperation();
+    ctxt->setCompositeOperation(!image->hasAlpha() && op == CompositeSourceOver ? CompositeCopy : op);
 
     ContextShadow* shadow = ctxt->contextShadow();
     if (shadow->m_type != ContextShadow::NoShadow) {
@@ -243,11 +234,9 @@ void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dst,
         }
     }
 
-    // Test using example site at
-    // http://www.meyerweb.com/eric/css/edge/complexspiral/demo.html
-    painter->drawPixmap(normalizedDst, *image, normalizedSrc);
+    ctxt->platformContext()->drawPixmap(normalizedDst, *image, normalizedSrc);
 
-    painter->setCompositionMode(lastCompositionMode);
+    ctxt->setCompositeOperation(previousOperator);
 
     if (imageObserver())
         imageObserver()->didDraw(this);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list