[SCM] WebKit Debian packaging branch, debian/experimental, updated. debian/1.3.8-1-1049-g2e11a8e

commit-queue at webkit.org commit-queue at webkit.org
Fri Jan 21 14:53:57 UTC 2011


The following commit has been merged in the debian/experimental branch:
commit 6a1fb1a576aaa72ac6dd67c7bc8088563aed995d
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Jan 4 00:21:05 2011 +0000

    2011-01-03  Helder Correia  <helder at sencha.com>
    
            Reviewed by Simon Fraser.
    
            ContextShadow can avoid code duplication for getting the CTM
            https://bugs.webkit.org/show_bug.cgi?id=51799
    
            ContextShadow defines its own getTransformationMatrixFromContext()
            which does exactly the same as GraphicsContext::getCTM().
    
            Existing tests: fast/canvas/canvas*shadow*html
    
            * platform/graphics/ContextShadow.cpp:
            (WebCore::ContextShadow::mustUseContextShadow):
            (WebCore::ContextShadow::adjustBlurDistance):
            (WebCore::ContextShadow::calculateLayerBoundingRect):
            * platform/graphics/ContextShadow.h:
            * platform/graphics/cairo/ContextShadowCairo.cpp:
            (WebCore::ContextShadow::beginShadowLayer):
            (WebCore::ContextShadow::endShadowLayer):
            (WebCore::ContextShadow::drawRectShadowWithoutTiling):
            * platform/graphics/cairo/FontCairo.cpp:
            (WebCore::drawGlyphsShadow):
            * platform/graphics/cairo/GraphicsContextCairo.cpp:
            (WebCore::drawPathShadow):
            * platform/graphics/cairo/ImageCairo.cpp:
            (WebCore::BitmapImage::draw):
            * platform/graphics/gtk/FontGtk.cpp:
            (WebCore::drawGlyphsShadow):
            * platform/graphics/qt/ContextShadowQt.cpp:
            (WebCore::ContextShadow::beginShadowLayer):
            (WebCore::ContextShadow::endShadowLayer):
            * platform/graphics/qt/FontQt.cpp:
            (WebCore::drawTextCommon):
            * platform/graphics/qt/GraphicsContextQt.cpp:
            (WebCore::GraphicsContext::fillPath):
            (WebCore::GraphicsContext::strokePath):
            (WebCore::GraphicsContext::fillRect):
            (WebCore::GraphicsContext::fillRoundedRect):
            * platform/graphics/qt/ImageQt.cpp:
            (WebCore::BitmapImage::draw):
            * platform/graphics/qt/StillImageQt.cpp:
            (WebCore::StillImage::draw):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@74947 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 6d96f4e..cc64e38 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,47 @@
+2011-01-03  Helder Correia  <helder at sencha.com>
+
+        Reviewed by Simon Fraser.
+
+        ContextShadow can avoid code duplication for getting the CTM
+        https://bugs.webkit.org/show_bug.cgi?id=51799
+
+        ContextShadow defines its own getTransformationMatrixFromContext()
+        which does exactly the same as GraphicsContext::getCTM().
+
+        Existing tests: fast/canvas/canvas*shadow*html
+
+        * platform/graphics/ContextShadow.cpp:
+        (WebCore::ContextShadow::mustUseContextShadow):
+        (WebCore::ContextShadow::adjustBlurDistance):
+        (WebCore::ContextShadow::calculateLayerBoundingRect):
+        * platform/graphics/ContextShadow.h:
+        * platform/graphics/cairo/ContextShadowCairo.cpp:
+        (WebCore::ContextShadow::beginShadowLayer):
+        (WebCore::ContextShadow::endShadowLayer):
+        (WebCore::ContextShadow::drawRectShadowWithoutTiling):
+        * platform/graphics/cairo/FontCairo.cpp:
+        (WebCore::drawGlyphsShadow):
+        * platform/graphics/cairo/GraphicsContextCairo.cpp:
+        (WebCore::drawPathShadow):
+        * platform/graphics/cairo/ImageCairo.cpp:
+        (WebCore::BitmapImage::draw):
+        * platform/graphics/gtk/FontGtk.cpp:
+        (WebCore::drawGlyphsShadow):
+        * platform/graphics/qt/ContextShadowQt.cpp:
+        (WebCore::ContextShadow::beginShadowLayer):
+        (WebCore::ContextShadow::endShadowLayer):
+        * platform/graphics/qt/FontQt.cpp:
+        (WebCore::drawTextCommon):
+        * platform/graphics/qt/GraphicsContextQt.cpp:
+        (WebCore::GraphicsContext::fillPath):
+        (WebCore::GraphicsContext::strokePath):
+        (WebCore::GraphicsContext::fillRect):
+        (WebCore::GraphicsContext::fillRoundedRect):
+        * platform/graphics/qt/ImageQt.cpp:
+        (WebCore::BitmapImage::draw):
+        * platform/graphics/qt/StillImageQt.cpp:
+        (WebCore::StillImage::draw):
+
 2011-01-03  Darin Adler  <darin at apple.com>
 
         Reviewed by Dan Bernstein.
diff --git a/WebCore/platform/graphics/ContextShadow.cpp b/WebCore/platform/graphics/ContextShadow.cpp
index 95aad46..763e595 100644
--- a/WebCore/platform/graphics/ContextShadow.cpp
+++ b/WebCore/platform/graphics/ContextShadow.cpp
@@ -29,7 +29,9 @@
 #include "config.h"
 #include "ContextShadow.h"
 
+#include "AffineTransform.h"
 #include "FloatQuad.h"
+#include "GraphicsContext.h"
 #include <cmath>
 #include <wtf/MathExtras.h>
 #include <wtf/Noncopyable.h>
@@ -81,7 +83,7 @@ void ContextShadow::clear()
     m_offset = FloatSize();
 }
 
-bool ContextShadow::mustUseContextShadow(PlatformContext context)
+bool ContextShadow::mustUseContextShadow(GraphicsContext* context)
 {
     // We can't avoid ContextShadow, since the shadow has blur.
     if (m_type == ContextShadow::BlurShadow)
@@ -91,8 +93,7 @@ bool ContextShadow::mustUseContextShadow(PlatformContext context)
     if (!shadowsIgnoreTransforms())
         return false;
     // We can avoid ContextShadow, since there are no transformations to apply to the canvas.
-    const AffineTransform transform(getTransformationMatrixFromContext(context));
-    if (transform.isIdentity())
+    if (context->getCTM().isIdentity())
         return false;
     // Otherwise, no chance avoiding ContextShadow.
     return true;
@@ -170,15 +171,15 @@ void ContextShadow::blurLayerImage(unsigned char* imageData, const IntSize& size
     }
 }
 
-void ContextShadow::adjustBlurDistance(const PlatformContext context)
+void ContextShadow::adjustBlurDistance(GraphicsContext* context)
 {
-    // Adjust blur if we're scaling, since the radius must not be affected by transformations.
-    const AffineTransform transform(getTransformationMatrixFromContext(context));
+    const AffineTransform transform = context->getCTM();
 
+    // Adjust blur if we're scaling, since the radius must not be affected by transformations.
     if (transform.isIdentity())
         return;
 
-    // Calculale transformed unit vectors.
+    // Calculate transformed unit vectors.
     const FloatQuad unitQuad(FloatPoint(0, 0), FloatPoint(1, 0),
                              FloatPoint(0, 1), FloatPoint(1, 1));
     const FloatQuad transformedUnitQuad = transform.mapQuad(unitQuad);
@@ -198,13 +199,13 @@ void ContextShadow::adjustBlurDistance(const PlatformContext context)
     m_blurDistance = roundf(static_cast<float>(m_blurDistance) / scale);
 }
 
-IntRect ContextShadow::calculateLayerBoundingRect(const PlatformContext context, const FloatRect& layerArea, const IntRect& clipRect)
+IntRect ContextShadow::calculateLayerBoundingRect(GraphicsContext* context, const FloatRect& layerArea, const IntRect& clipRect)
 {
     // Calculate the destination of the blurred and/or transformed layer.
     FloatRect layerFloatRect;
     float inflation = 0;
 
-    const AffineTransform transform(getTransformationMatrixFromContext(context));
+    const AffineTransform transform = context->getCTM();
     if (m_shadowsIgnoreTransforms && !transform.isIdentity()) {
         FloatQuad transformedPolygon = transform.mapQuad(FloatQuad(layerArea));
         transformedPolygon.move(m_offset);
diff --git a/WebCore/platform/graphics/ContextShadow.h b/WebCore/platform/graphics/ContextShadow.h
index e5e5a8e..a1fba5c 100644
--- a/WebCore/platform/graphics/ContextShadow.h
+++ b/WebCore/platform/graphics/ContextShadow.h
@@ -29,10 +29,8 @@
 #ifndef ContextShadow_h
 #define ContextShadow_h
 
-#include "AffineTransform.h"
 #include "Color.h"
 #include "FloatRect.h"
-#include "GraphicsContext.h"
 #include "IntRect.h"
 #include "RefCounted.h"
 
@@ -48,6 +46,9 @@ QT_END_NAMESPACE
 
 namespace WebCore {
 
+class AffineTransform;
+class GraphicsContext;
+
 #if PLATFORM(CAIRO)
 typedef cairo_surface_t* PlatformImage;
 typedef cairo_t* PlatformContext;
@@ -82,7 +83,7 @@ public:
     ContextShadow();
     ContextShadow(const Color&, float radius, const FloatSize& offset);
 
-    bool mustUseContextShadow(PlatformContext);
+    bool mustUseContextShadow(GraphicsContext*);
     void clear();
 
     // The pair beginShadowLayer and endShadowLayer creates a temporary image
@@ -107,10 +108,9 @@ public:
     // original context. If blur radius is specified, the shadow will be
     // filtered first.
 
-    PlatformContext beginShadowLayer(PlatformContext, const FloatRect& layerArea);
-    void endShadowLayer(PlatformContext);
+    PlatformContext beginShadowLayer(GraphicsContext*, const FloatRect& layerArea);
+    void endShadowLayer(GraphicsContext*);
     static void purgeScratchBuffer();
-    static AffineTransform getTransformationMatrixFromContext(PlatformContext);
 
     void setShadowsIgnoreTransforms(bool enable) { m_shadowsIgnoreTransforms = enable; }
     bool shadowsIgnoreTransforms() const { return m_shadowsIgnoreTransforms; }
@@ -129,12 +129,12 @@ private:
     FloatPoint m_layerContextTranslation; // Translation to apply to m_layerContext for the shadow to be correctly clipped.
     bool m_shadowsIgnoreTransforms;
 
-    void adjustBlurDistance(const PlatformContext);
+    void adjustBlurDistance(GraphicsContext*);
     void blurLayerImage(unsigned char*, const IntSize& imageSize, int stride);
-    IntRect calculateLayerBoundingRect(const PlatformContext, const FloatRect& layerArea, const IntRect& clipRect);
+    IntRect calculateLayerBoundingRect(GraphicsContext*, const FloatRect& layerArea, const IntRect& clipRect);
 
 #if PLATFORM(CAIRO)
-    void drawRectShadowWithoutTiling(PlatformContext context, const IntRect& shadowRect, const IntSize& topLeftRadius, const IntSize& topRightRadius, const IntSize& bottomLeftRadius, const IntSize& bottomRightRadius, float alpha);
+    void drawRectShadowWithoutTiling(GraphicsContext*, const IntRect& shadowRect, const IntSize& topLeftRadius, const IntSize& topRightRadius, const IntSize& bottomLeftRadius, const IntSize& bottomRightRadius, float alpha);
 #endif
 };
 
diff --git a/WebCore/platform/graphics/cairo/ContextShadowCairo.cpp b/WebCore/platform/graphics/cairo/ContextShadowCairo.cpp
index c52cc3a..e8ef0c6 100644
--- a/WebCore/platform/graphics/cairo/ContextShadowCairo.cpp
+++ b/WebCore/platform/graphics/cairo/ContextShadowCairo.cpp
@@ -29,7 +29,9 @@
 #include "config.h"
 #include "ContextShadow.h"
 
+#include "AffineTransform.h"
 #include "CairoUtilities.h"
+#include "GraphicsContext.h"
 #include "OwnPtrCairo.h"
 #include "Path.h"
 #include "Timer.h"
@@ -81,20 +83,12 @@ static cairo_surface_t* getScratchBuffer(const IntSize& size)
     return scratchBuffer;
 }
 
-AffineTransform ContextShadow::getTransformationMatrixFromContext(PlatformContext context)
-{
-    cairo_matrix_t transform;
-    cairo_get_matrix(context, &transform);
-    return AffineTransform(transform.xx, transform.yx, transform.xy,
-                           transform.yy, transform.x0, transform.y0);
-}
-
-PlatformContext ContextShadow::beginShadowLayer(PlatformContext context, const FloatRect& layerArea)
+PlatformContext ContextShadow::beginShadowLayer(GraphicsContext* context, const FloatRect& layerArea)
 {
     adjustBlurDistance(context);
 
     double x1, x2, y1, y2;
-    cairo_clip_extents(context, &x1, &y1, &x2, &y2);
+    cairo_clip_extents(context->platformContext(), &x1, &y1, &x2, &y2);
     IntRect layerRect = calculateLayerBoundingRect(context, layerArea, IntRect(x1, y1, x2 - x1, y2 - y1));
 
     // Don't paint if we are totally outside the clip region.
@@ -113,7 +107,7 @@ PlatformContext ContextShadow::beginShadowLayer(PlatformContext context, const F
     return m_layerContext;
 }
 
-void ContextShadow::endShadowLayer(cairo_t* cr)
+void ContextShadow::endShadowLayer(GraphicsContext* context)
 {
     cairo_destroy(m_layerContext);
     m_layerContext = 0;
@@ -126,6 +120,7 @@ void ContextShadow::endShadowLayer(cairo_t* cr)
         cairo_surface_mark_dirty(m_layerImage);
     }
 
+    cairo_t* cr = context->platformContext();
     cairo_save(cr);
     setSourceRGBAFromColor(cr, m_color);
     cairo_mask_surface(cr, m_layerImage, m_layerOrigin.x(), m_layerOrigin.y());
@@ -135,7 +130,7 @@ void ContextShadow::endShadowLayer(cairo_t* cr)
     scheduleScratchBufferPurge();
 }
 
-void ContextShadow::drawRectShadowWithoutTiling(PlatformContext context, const IntRect& shadowRect, const IntSize& topLeftRadius, const IntSize& topRightRadius, const IntSize& bottomLeftRadius, const IntSize& bottomRightRadius, float alpha)
+void ContextShadow::drawRectShadowWithoutTiling(GraphicsContext* context, const IntRect& shadowRect, const IntSize& topLeftRadius, const IntSize& topRightRadius, const IntSize& bottomLeftRadius, const IntSize& bottomRightRadius, float alpha)
 {
     beginShadowLayer(context, shadowRect);
 
@@ -201,7 +196,7 @@ void ContextShadow::drawRectShadow(GraphicsContext* context, const IntRect& rect
     cairo_t* cr = context->platformContext();
     if ((!context->getCTM().isIdentityOrTranslationOrFlipped()) || (radiusTwice > rect.width())
         || (radiusTwice > rect.height()) || (m_type != BlurShadow)) {
-        drawRectShadowWithoutTiling(cr, rect, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius, context->getAlpha());
+        drawRectShadowWithoutTiling(context, rect, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius, context->getAlpha());
         return;
     }
 
@@ -229,10 +224,10 @@ void ContextShadow::drawRectShadow(GraphicsContext* context, const IntRect& rect
     // Reduce the size of what we have to draw with the clip area.
     double x1, x2, y1, y2;
     cairo_clip_extents(cr, &x1, &y1, &x2, &y2);
-    calculateLayerBoundingRect(cr, shadowRect, IntRect(x1, y1, x2 - x1, y2 - y1));
+    calculateLayerBoundingRect(context, shadowRect, IntRect(x1, y1, x2 - x1, y2 - y1));
 
     if ((shadowTemplateSize.width() * shadowTemplateSize.height() > m_sourceRect.width() * m_sourceRect.height())) {
-        drawRectShadowWithoutTiling(cr, rect, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius, context->getAlpha());
+        drawRectShadowWithoutTiling(context, rect, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius, context->getAlpha());
         return;
     }
 
diff --git a/WebCore/platform/graphics/cairo/FontCairo.cpp b/WebCore/platform/graphics/cairo/FontCairo.cpp
index 0d92ada..2d79499 100644
--- a/WebCore/platform/graphics/cairo/FontCairo.cpp
+++ b/WebCore/platform/graphics/cairo/FontCairo.cpp
@@ -72,7 +72,7 @@ static void drawGlyphsShadow(GraphicsContext* graphicsContext, cairo_t* context,
     if (!(graphicsContext->textDrawingMode() & TextModeFill) || shadow->m_type == ContextShadow::NoShadow)
         return;
 
-    if (!shadow->mustUseContextShadow(context)) {
+    if (!shadow->mustUseContextShadow(graphicsContext)) {
         // Optimize non-blurry shadows, by just drawing text without the ContextShadow.
         cairo_save(context);
         cairo_translate(context, shadow->m_offset.width(), shadow->m_offset.height());
@@ -86,11 +86,11 @@ static void drawGlyphsShadow(GraphicsContext* graphicsContext, cairo_t* context,
     cairo_text_extents_t extents;
     cairo_scaled_font_glyph_extents(font->platformData().scaledFont(), glyphs, numGlyphs, &extents);
     FloatRect fontExtentsRect(point.x(), point.y() - extents.height, extents.width, extents.height);
-    cairo_t* shadowContext = shadow->beginShadowLayer(context, fontExtentsRect);
+    cairo_t* shadowContext = shadow->beginShadowLayer(graphicsContext, fontExtentsRect);
     if (shadowContext) {
         prepareContextForGlyphDrawing(shadowContext, font, point);
         drawGlyphsToContext(shadowContext, font, glyphs, numGlyphs);
-        shadow->endShadowLayer(context);
+        shadow->endShadowLayer(graphicsContext);
     }
 }
 
diff --git a/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp b/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
index 5885ea9..a783e2b 100644
--- a/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
+++ b/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
@@ -165,7 +165,7 @@ static inline void drawPathShadow(GraphicsContext* context, PathDrawingStyle dra
         solidFigureExtents.unite(fillExtents);
     }
 
-    cairo_t* shadowContext = shadow->beginShadowLayer(cairoContext, solidFigureExtents);
+    cairo_t* shadowContext = shadow->beginShadowLayer(context, solidFigureExtents);
     if (!shadowContext)
         return;
 
@@ -179,7 +179,7 @@ static inline void drawPathShadow(GraphicsContext* context, PathDrawingStyle dra
     if (drawingStyle & Stroke)
         setPlatformStroke(context, shadowContext);
 
-    shadow->endShadowLayer(cairoContext);
+    shadow->endShadowLayer(context);
 }
 
 static void fillCurrentCairoPath(GraphicsContext* context, cairo_t* cairoContext)
diff --git a/WebCore/platform/graphics/cairo/ImageCairo.cpp b/WebCore/platform/graphics/cairo/ImageCairo.cpp
index 0ac3955..e51d65a 100644
--- a/WebCore/platform/graphics/cairo/ImageCairo.cpp
+++ b/WebCore/platform/graphics/cairo/ImageCairo.cpp
@@ -138,13 +138,13 @@ void BitmapImage::draw(GraphicsContext* context, const FloatRect& dst, const Flo
     ContextShadow* shadow = context->contextShadow();
     ASSERT(shadow);
     if (shadow->m_type != ContextShadow::NoShadow) {
-        cairo_t* shadowContext = shadow->beginShadowLayer(cr, dstRect);
+        cairo_t* shadowContext = shadow->beginShadowLayer(context, dstRect);
         if (shadowContext) {
             cairo_translate(shadowContext, dstRect.x(), dstRect.y());
             cairo_set_source(shadowContext, pattern);
             cairo_rectangle(shadowContext, 0, 0, dstRect.width(), dstRect.height());
             cairo_fill(shadowContext);
-            shadow->endShadowLayer(cr);
+            shadow->endShadowLayer(context);
         }
     }
 
diff --git a/WebCore/platform/graphics/gtk/FontGtk.cpp b/WebCore/platform/graphics/gtk/FontGtk.cpp
index eabd913..87fccc8 100644
--- a/WebCore/platform/graphics/gtk/FontGtk.cpp
+++ b/WebCore/platform/graphics/gtk/FontGtk.cpp
@@ -240,7 +240,7 @@ static void drawGlyphsShadow(GraphicsContext* graphicsContext, cairo_t* context,
 
     FloatRect extents(getPangoRegionExtents(renderRegion));
     extents.setLocation(FloatPoint(point.x(), point.y() - extents.height()));
-    cairo_t* shadowContext = shadow->beginShadowLayer(context, extents);
+    cairo_t* shadowContext = shadow->beginShadowLayer(graphicsContext, extents);
     if (shadowContext) {
         cairo_translate(shadowContext, point.x(), point.y());
         pango_cairo_show_layout_line(shadowContext, layoutLine);
@@ -255,7 +255,7 @@ static void drawGlyphsShadow(GraphicsContext* graphicsContext, cairo_t* context,
         cairo_clip(context);
         cairo_translate(context, -totalOffset.x(), -totalOffset.y());
 
-        shadow->endShadowLayer(context);
+        shadow->endShadowLayer(graphicsContext);
         cairo_restore(context);
     }
 }
diff --git a/WebCore/platform/graphics/qt/ContextShadowQt.cpp b/WebCore/platform/graphics/qt/ContextShadowQt.cpp
index e0e7422..834ca62 100644
--- a/WebCore/platform/graphics/qt/ContextShadowQt.cpp
+++ b/WebCore/platform/graphics/qt/ContextShadowQt.cpp
@@ -28,6 +28,8 @@
 #include "config.h"
 #include "ContextShadow.h"
 
+#include "AffineTransform.h"
+#include "GraphicsContext.h"
 #include <QPainter>
 #include <QTimerEvent>
 
@@ -100,19 +102,14 @@ void ShadowBuffer::timerEvent(QTimerEvent* event)
     QObject::timerEvent(event);
 }
 
-AffineTransform ContextShadow::getTransformationMatrixFromContext(PlatformContext context)
-{
-    const QTransform& transform = context->transform();
-    return AffineTransform(transform.m11(), transform.m12(), transform.m21(),
-                           transform.m22(), transform.dx(), transform.dy());
-}
-
 Q_GLOBAL_STATIC(ShadowBuffer, scratchShadowBuffer)
 
-PlatformContext ContextShadow::beginShadowLayer(PlatformContext p, const FloatRect& layerArea)
+PlatformContext ContextShadow::beginShadowLayer(GraphicsContext* context, const FloatRect& layerArea)
 {
     // Set m_blurDistance.
-    adjustBlurDistance(p);
+    adjustBlurDistance(context);
+
+    PlatformContext p = context->platformContext();
 
     QRect clipRect;
     if (p->hasClipping())
@@ -126,7 +123,7 @@ PlatformContext ContextShadow::beginShadowLayer(PlatformContext p, const FloatRe
 
     // Set m_layerOrigin, m_layerContextTranslation, m_sourceRect.
     IntRect clip(clipRect.x(), clipRect.y(), clipRect.width(), clipRect.height());
-    IntRect layerRect = calculateLayerBoundingRect(p, layerArea, clip);
+    IntRect layerRect = calculateLayerBoundingRect(context, layerArea, clip);
 
     // Don't paint if we are totally outside the clip region.
     if (layerRect.isEmpty())
@@ -143,7 +140,7 @@ PlatformContext ContextShadow::beginShadowLayer(PlatformContext p, const FloatRe
     return m_layerContext;
 }
 
-void ContextShadow::endShadowLayer(PlatformContext p)
+void ContextShadow::endShadowLayer(GraphicsContext* context)
 {
     m_layerContext->end();
     delete m_layerContext;
@@ -162,7 +159,7 @@ void ContextShadow::endShadowLayer(PlatformContext p)
         p.end();
     }
 
-    p->drawImage(m_layerOrigin, m_layerImage, m_sourceRect);
+    context->platformContext()->drawImage(m_layerOrigin, m_layerImage, m_sourceRect);
 
     scratchShadowBuffer()->schedulePurge();
 }
diff --git a/WebCore/platform/graphics/qt/FontQt.cpp b/WebCore/platform/graphics/qt/FontQt.cpp
index 131ae93..969a2aa 100644
--- a/WebCore/platform/graphics/qt/FontQt.cpp
+++ b/WebCore/platform/graphics/qt/FontQt.cpp
@@ -146,20 +146,20 @@ static void drawTextCommon(GraphicsContext* ctx, const TextRun& run, const Float
 
             if (ctxShadow->m_type != ContextShadow::NoShadow) {
                 ContextShadow* ctxShadow = ctx->contextShadow();
-                if (!ctxShadow->mustUseContextShadow(p)) {
+                if (!ctxShadow->mustUseContextShadow(ctx)) {
                     p->save();
                     p->setPen(ctxShadow->m_color);
                     p->translate(ctxShadow->offset());
                     line.draw(p, pt);
                     p->restore();
                 } else {
-                    QPainter* shadowPainter = ctxShadow->beginShadowLayer(p, boundingRect);
+                    QPainter* shadowPainter = ctxShadow->beginShadowLayer(ctx, boundingRect);
                     if (shadowPainter) {
                         // Since it will be blurred anyway, we don't care about render hints.
                         shadowPainter->setFont(p->font());
                         shadowPainter->setPen(ctxShadow->m_color);
                         line.draw(shadowPainter, pt);
-                        ctxShadow->endShadowLayer(p);
+                        ctxShadow->endShadowLayer(ctx);
                     }
                 }
             }
@@ -204,13 +204,13 @@ static void drawTextCommon(GraphicsContext* ctx, const TextRun& run, const Float
 #else
                 QRectF boundingRect(pt.x(), point.y() - fm.ascent(), fm.width(string), fm.height());
 #endif
-                QPainter* shadowPainter = ctxShadow->beginShadowLayer(p, boundingRect);
+                QPainter* shadowPainter = ctxShadow->beginShadowLayer(ctx, boundingRect);
                 if (shadowPainter) {
                     // Since it will be blurred anyway, we don't care about render hints.
                     shadowPainter->setFont(p->font());
                     shadowPainter->setPen(ctxShadow->m_color);
                     shadowPainter->drawText(pt, string, flags, run.padding());
-                    ctxShadow->endShadowLayer(p);
+                    ctxShadow->endShadowLayer(ctx);
                 }
             }
         } else if (ctx->textDrawingMode() & TextModeStroke) {
@@ -225,12 +225,12 @@ static void drawTextCommon(GraphicsContext* ctx, const TextRun& run, const Float
 #else
                 QRectF boundingRect(pt.x(), point.y() - fm.ascent(), fm.width(string), fm.height());
 #endif
-                QPainter* shadowPainter = ctxShadow->beginShadowLayer(p, boundingRect);
+                QPainter* shadowPainter = ctxShadow->beginShadowLayer(ctx, boundingRect);
                 if (shadowPainter) {
                     // Since it will be blurred anyway, we don't care about render hints.
                     shadowPainter->setFont(p->font());
                     shadowPainter->strokePath(textStrokePath, QPen(ctxShadow->m_color));
-                    ctxShadow->endShadowLayer(p);
+                    ctxShadow->endShadowLayer(ctx);
                 }
             }
         }
diff --git a/WebCore/platform/graphics/qt/GraphicsContextQt.cpp b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
index 0cf6f22..8ecb666 100644
--- a/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
+++ b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
@@ -510,13 +510,13 @@ void GraphicsContext::fillPath(const Path& path)
 
     if (m_data->hasShadow()) {
         ContextShadow* shadow = contextShadow();
-        if (shadow->mustUseContextShadow(p) || m_state.fillPattern || m_state.fillGradient)
+        if (shadow->mustUseContextShadow(this) || m_state.fillPattern || m_state.fillGradient)
         {
-            QPainter* shadowPainter = shadow->beginShadowLayer(p, platformPath.controlPointRect());
+            QPainter* shadowPainter = shadow->beginShadowLayer(this, platformPath.controlPointRect());
             if (shadowPainter) {
                 shadowPainter->setCompositionMode(QPainter::CompositionMode_Source);
                 shadowPainter->fillPath(platformPath, QColor(m_data->shadow.m_color));
-                shadow->endShadowLayer(p);
+                shadow->endShadowLayer(this);
             }
         } else {
             QPointF offset = shadow->offset();
@@ -548,15 +548,15 @@ void GraphicsContext::strokePath(const Path& path)
 
     if (m_data->hasShadow()) {
         ContextShadow* shadow = contextShadow();
-        if (shadow->mustUseContextShadow(p) || m_state.strokePattern || m_state.strokeGradient)
+        if (shadow->mustUseContextShadow(this) || m_state.strokePattern || m_state.strokeGradient)
         {
             FloatRect boundingRect = platformPath.controlPointRect();
             boundingRect.inflate(pen.miterLimit() + pen.widthF());
-            QPainter* shadowPainter = shadow->beginShadowLayer(p, boundingRect);
+            QPainter* shadowPainter = shadow->beginShadowLayer(this, boundingRect);
             if (shadowPainter) {
                 shadowPainter->setOpacity(static_cast<qreal>(m_data->shadow.m_color.alpha()) / 255);
                 shadowPainter->strokePath(platformPath, pen);
-                shadow->endShadowLayer(p);
+                shadow->endShadowLayer(this);
             }
         } else {
             QPen shadowPen(pen);
@@ -663,33 +663,33 @@ void GraphicsContext::fillRect(const FloatRect& rect)
         AffineTransform affine;
         QBrush brush(m_state.fillPattern->createPlatformPattern(affine));
         QPixmap* image = m_state.fillPattern->tileImage()->nativeImageForCurrentFrame();
-        QPainter* shadowPainter = m_data->hasShadow() ? shadow->beginShadowLayer(p, normalizedRect) : 0;
+        QPainter* shadowPainter = m_data->hasShadow() ? shadow->beginShadowLayer(this, normalizedRect) : 0;
         if (shadowPainter) {
             drawRepeatPattern(shadowPainter, image, normalizedRect, m_state.fillPattern->repeatX(), m_state.fillPattern->repeatY());
             shadowPainter->setCompositionMode(QPainter::CompositionMode_SourceIn);
             shadowPainter->fillRect(normalizedRect, shadow->m_color);
-            shadow->endShadowLayer(p);
+            shadow->endShadowLayer(this);
         }
         drawRepeatPattern(p, image, normalizedRect, m_state.fillPattern->repeatX(), m_state.fillPattern->repeatY());
     } else if (m_state.fillGradient) {
         QBrush brush(*m_state.fillGradient->platformGradient());
         brush.setTransform(m_state.fillGradient->gradientSpaceTransform());
-        QPainter* shadowPainter = m_data->hasShadow() ? shadow->beginShadowLayer(p, normalizedRect) : 0;
+        QPainter* shadowPainter = m_data->hasShadow() ? shadow->beginShadowLayer(this, normalizedRect) : 0;
         if (shadowPainter) {
             shadowPainter->fillRect(normalizedRect, brush);
             shadowPainter->setCompositionMode(QPainter::CompositionMode_SourceIn);
             shadowPainter->fillRect(normalizedRect, shadow->m_color);
-            shadow->endShadowLayer(p);
+            shadow->endShadowLayer(this);
         }
         p->fillRect(normalizedRect, brush);
     } else {
         if (m_data->hasShadow()) {
-            if (shadow->mustUseContextShadow(p)) {
-                QPainter* shadowPainter = shadow->beginShadowLayer(p, normalizedRect);
+            if (shadow->mustUseContextShadow(this)) {
+                QPainter* shadowPainter = shadow->beginShadowLayer(this, normalizedRect);
                 if (shadowPainter) {
                     shadowPainter->setOpacity(static_cast<qreal>(shadow->m_color.alpha()) / 255);
                     shadowPainter->fillRect(normalizedRect, p->brush());
-                    shadow->endShadowLayer(p);
+                    shadow->endShadowLayer(this);
                 }
             } else {
                 // Solid rectangle fill with no blur shadow or transformations applied can be done
@@ -716,12 +716,12 @@ void GraphicsContext::fillRect(const FloatRect& rect, const Color& color, ColorS
 
     if (m_data->hasShadow()) {
         ContextShadow* shadow = contextShadow();
-        if (shadow->mustUseContextShadow(p)) {
-            QPainter* shadowPainter = shadow->beginShadowLayer(p, normalizedRect);
+        if (shadow->mustUseContextShadow(this)) {
+            QPainter* shadowPainter = shadow->beginShadowLayer(this, normalizedRect);
             if (shadowPainter) {
                 shadowPainter->setCompositionMode(QPainter::CompositionMode_Source);
                 shadowPainter->fillRect(normalizedRect, shadow->m_color);
-                shadow->endShadowLayer(p);
+                shadow->endShadowLayer(this);
             }
         } else
             p->fillRect(normalizedRect.translated(shadow->offset()), shadow->m_color);
@@ -740,12 +740,12 @@ void GraphicsContext::fillRoundedRect(const IntRect& rect, const IntSize& topLef
     QPainter* p = m_data->p();
     if (m_data->hasShadow()) {
         ContextShadow* shadow = contextShadow();
-        if (shadow->mustUseContextShadow(p)) {
-            QPainter* shadowPainter = shadow->beginShadowLayer(p, rect);
+        if (shadow->mustUseContextShadow(this)) {
+            QPainter* shadowPainter = shadow->beginShadowLayer(this, rect);
             if (shadowPainter) {
                 shadowPainter->setCompositionMode(QPainter::CompositionMode_Source);
                 shadowPainter->fillPath(path.platformPath(), QColor(m_data->shadow.m_color));
-                shadow->endShadowLayer(p);
+                shadow->endShadowLayer(this);
             }
         } else {
             p->translate(m_data->shadow.offset());
diff --git a/WebCore/platform/graphics/qt/ImageQt.cpp b/WebCore/platform/graphics/qt/ImageQt.cpp
index f713d37..49afd29 100644
--- a/WebCore/platform/graphics/qt/ImageQt.cpp
+++ b/WebCore/platform/graphics/qt/ImageQt.cpp
@@ -209,11 +209,11 @@ void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dst,
 
     ContextShadow* shadow = ctxt->contextShadow();
     if (shadow->m_type != ContextShadow::NoShadow) {
-        QPainter* shadowPainter = shadow->beginShadowLayer(painter, normalizedDst);
+        QPainter* shadowPainter = shadow->beginShadowLayer(ctxt, normalizedDst);
         if (shadowPainter) {
             shadowPainter->setOpacity(static_cast<qreal>(shadow->m_color.alpha()) / 255);
             shadowPainter->drawPixmap(normalizedDst, *image, normalizedSrc);
-            shadow->endShadowLayer(painter);
+            shadow->endShadowLayer(ctxt);
         }
     }
 
diff --git a/WebCore/platform/graphics/qt/StillImageQt.cpp b/WebCore/platform/graphics/qt/StillImageQt.cpp
index 51c9499..3b08995 100644
--- a/WebCore/platform/graphics/qt/StillImageQt.cpp
+++ b/WebCore/platform/graphics/qt/StillImageQt.cpp
@@ -74,19 +74,17 @@ void StillImage::draw(GraphicsContext* ctxt, const FloatRect& dst,
     CompositeOperator previousOperator = ctxt->compositeOperation();
     ctxt->setCompositeOperation(op);
 
-    QPainter* painter = ctxt->platformContext();
-
     ContextShadow* shadow = ctxt->contextShadow();
     if (shadow->m_type != ContextShadow::NoShadow) {
-        QPainter* shadowPainter = shadow->beginShadowLayer(painter, normalizedDst);
+        QPainter* shadowPainter = shadow->beginShadowLayer(ctxt, normalizedDst);
         if (shadowPainter) {
             shadowPainter->setOpacity(static_cast<qreal>(shadow->m_color.alpha()) / 255);
             shadowPainter->drawPixmap(normalizedDst, *m_pixmap, normalizedSrc);
-            shadow->endShadowLayer(painter);
+            shadow->endShadowLayer(ctxt);
         }
     }
 
-    painter->drawPixmap(normalizedDst, *m_pixmap, normalizedSrc);
+    ctxt->platformContext()->drawPixmap(normalizedDst, *m_pixmap, normalizedSrc);
     ctxt->setCompositeOperation(previousOperator);
 }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list