[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

andreas.kling at nokia.com andreas.kling at nokia.com
Wed Dec 22 15:15:22 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 457aef3a3ba1a31ce0f6e4bd013d64d5600ec64b
Author: andreas.kling at nokia.com <andreas.kling at nokia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Oct 29 13:44:19 2010 +0000

    2010-10-29  Andreas Kling  <kling at webkit.org>
    
            Reviewed by Kenneth Rohde Christiansen.
    
            [Qt] Make GraphicsContext cheaper to construct
            https://bugs.webkit.org/show_bug.cgi?id=48626
    
            Do less unnecessary things when creating the Qt GraphicsContext:
            - Don't create a black QBrush that's immediately discarded.
            - Don't call setPlatform*(), set the painter brush and pen directly.
            - Call setRenderHints() once instead of multiple setRenderHint().
    
            * platform/graphics/qt/GraphicsContextQt.cpp:
            (WebCore::GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate):
            (WebCore::GraphicsContext::GraphicsContext):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@70870 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index d22f617..ee697d6 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,5 +1,21 @@
 2010-10-29  Andreas Kling  <kling at webkit.org>
 
+        Reviewed by Kenneth Rohde Christiansen.
+
+        [Qt] Make GraphicsContext cheaper to construct
+        https://bugs.webkit.org/show_bug.cgi?id=48626
+
+        Do less unnecessary things when creating the Qt GraphicsContext:
+        - Don't create a black QBrush that's immediately discarded.
+        - Don't call setPlatform*(), set the painter brush and pen directly.
+        - Call setRenderHints() once instead of multiple setRenderHint().
+
+        * platform/graphics/qt/GraphicsContextQt.cpp:
+        (WebCore::GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate):
+        (WebCore::GraphicsContext::GraphicsContext):
+
+2010-10-29  Andreas Kling  <kling at webkit.org>
+
         Reviewed by Simon Hausmann.
 
         [Qt] GraphicsLayer: Don't notifySyncRequired() more than necessary
diff --git a/WebCore/platform/graphics/qt/GraphicsContextQt.cpp b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
index 8b34f51..50971b5 100644
--- a/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
+++ b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
@@ -171,7 +171,7 @@ static inline Qt::FillRule toQtFillRule(WindRule rule)
 
 class GraphicsContextPlatformPrivate : public Noncopyable {
 public:
-    GraphicsContextPlatformPrivate(QPainter* painter);
+    GraphicsContextPlatformPrivate(QPainter*, const QColor& initialSolidColor);
     ~GraphicsContextPlatformPrivate();
 
     inline QPainter* p() const
@@ -225,42 +225,42 @@ private:
 };
 
 
-GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate(QPainter* p)
+GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate(QPainter* p, const QColor& initialSolidColor)
+    : antiAliasingForRectsAndLines(false)
+    , layerCount(0)
+    , solidColor(initialSolidColor)
+    , imageInterpolationQuality(InterpolationDefault)
+    , painter(p)
 {
-    painter = p;
-    layerCount = 0;
-
-    solidColor = QBrush(Qt::black);
+    if (!painter)
+        return;
 
-    imageInterpolationQuality = InterpolationDefault;
+    // Use the default the QPainter was constructed with.
+    antiAliasingForRectsAndLines = painter->testRenderHint(QPainter::Antialiasing);
 
-    if (painter) {
-        // use the default the QPainter was constructed with
-        antiAliasingForRectsAndLines = painter->testRenderHint(QPainter::Antialiasing);
-        // FIXME: Maybe only enable in SVG mode?
-        painter->setRenderHint(QPainter::Antialiasing, true);
-        painter->setRenderHint(QPainter::SmoothPixmapTransform, true);
-    } else
-        antiAliasingForRectsAndLines = false;
+    painter->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform, true);
 }
 
 GraphicsContextPlatformPrivate::~GraphicsContextPlatformPrivate()
 {
 }
 
-GraphicsContext::GraphicsContext(PlatformGraphicsContext* context)
+GraphicsContext::GraphicsContext(PlatformGraphicsContext* painter)
     : m_common(createGraphicsContextPrivate())
-    , m_data(new GraphicsContextPlatformPrivate(context))
+    , m_data(new GraphicsContextPlatformPrivate(painter, fillColor()))
 {
-    setPaintingDisabled(!context);
-    if (context) {
-        // Make sure the context starts in sync with our state.
-        setPlatformFillColor(fillColor(), ColorSpaceDeviceRGB);
-        setPlatformStrokeColor(strokeColor(), ColorSpaceDeviceRGB);
+    setPaintingDisabled(!painter);
 
-        // Make sure we start with the correct join mode.
-        setLineJoin(MiterJoin);
-    }
+    if (!painter)
+        return;
+
+    // solidColor is initialized with the fillColor().
+    painter->setBrush(m_data->solidColor);
+
+    QPen pen(painter->pen());
+    pen.setColor(strokeColor());
+    pen.setJoinStyle(toQtLineJoin(MiterJoin));
+    painter->setPen(pen);
 }
 
 GraphicsContext::~GraphicsContext()

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list