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

krit at webkit.org krit at webkit.org
Wed Dec 22 14:17:15 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 2895baf9ef3399c5678452af24fd74f827334715
Author: krit at webkit.org <krit at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Oct 6 12:47:28 2010 +0000

    2010-10-06  Dirk Schulze  <krit at webkit.org>
    
            Unreviewed fix of Cairo ports.
    
            SVGs with filters look grainy when scaled
            https://bugs.webkit.org/show_bug.cgi?id=5526
    
            Fixed issues on Cairos shadow implementation after the changes to FilterEffects.
            Cairo calculates the inflation of the effect rect itself. Respect this for FEGaussianBlur.
            This is just a temporary solution, since Cairo and Qt will use ContextShadow soon.
    
            * platform/graphics/GraphicsContext.h:
            * platform/graphics/cairo/GraphicsContextCairo.cpp:
            (WebCore::drawBorderlessRectShadow):
            (WebCore::GraphicsContext::applyPlatformShadow):
            (WebCore::GraphicsContext::createShadowMask):
            (WebCore::GraphicsContext::drawTiledShadow):
            (WebCore::GraphicsContext::fillRoundedRect):
            * platform/graphics/filters/ImageBufferFilter.cpp:
            (WebCore::ImageBufferFilter::ImageBufferFilter):
            (WebCore::ImageBufferFilter::create):
            * platform/graphics/filters/ImageBufferFilter.h:
            (WebCore::ImageBufferFilter::filterRegion):
            (WebCore::ImageBufferFilter::sourceImageRect):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69187 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index be06279..27af6a1 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,28 @@
+2010-10-06  Dirk Schulze  <krit at webkit.org>
+
+        Unreviewed fix of Cairo ports.
+
+        SVGs with filters look grainy when scaled
+        https://bugs.webkit.org/show_bug.cgi?id=5526
+
+        Fixed issues on Cairos shadow implementation after the changes to FilterEffects.
+        Cairo calculates the inflation of the effect rect itself. Respect this for FEGaussianBlur.
+        This is just a temporary solution, since Cairo and Qt will use ContextShadow soon.
+
+        * platform/graphics/GraphicsContext.h:
+        * platform/graphics/cairo/GraphicsContextCairo.cpp:
+        (WebCore::drawBorderlessRectShadow):
+        (WebCore::GraphicsContext::applyPlatformShadow):
+        (WebCore::GraphicsContext::createShadowMask):
+        (WebCore::GraphicsContext::drawTiledShadow):
+        (WebCore::GraphicsContext::fillRoundedRect):
+        * platform/graphics/filters/ImageBufferFilter.cpp:
+        (WebCore::ImageBufferFilter::ImageBufferFilter):
+        (WebCore::ImageBufferFilter::create):
+        * platform/graphics/filters/ImageBufferFilter.h:
+        (WebCore::ImageBufferFilter::filterRegion):
+        (WebCore::ImageBufferFilter::sourceImageRect):
+
 2010-10-06  Nikolas Zimmermann  <nzimmermann at rim.com>
 
         Reviewed by Dirk Schulze.
diff --git a/WebCore/platform/graphics/GraphicsContext.h b/WebCore/platform/graphics/GraphicsContext.h
index 4cf7c00..4d55e3d 100644
--- a/WebCore/platform/graphics/GraphicsContext.h
+++ b/WebCore/platform/graphics/GraphicsContext.h
@@ -298,8 +298,8 @@ namespace WebCore {
         void setAlpha(float);
 #if PLATFORM(CAIRO)
         float getAlpha();
-        void applyPlatformShadow(PassOwnPtr<ImageBuffer> buffer, const Color& shadowColor, const FloatRect& shadowRect, float radius);
-        PlatformRefPtr<cairo_surface_t> createShadowMask(PassOwnPtr<ImageBuffer>, const FloatRect&, float radius);
+        void applyPlatformShadow(PassOwnPtr<ImageBuffer> buffer, const Color& shadowColor, FloatRect& shadowRect, float radius);
+        PlatformRefPtr<cairo_surface_t> createShadowMask(PassOwnPtr<ImageBuffer>, FloatRect&, float radius);
 
         static void calculateShadowBufferDimensions(IntSize& shadowBufferSize, FloatRect& shadowRect, float& radius, const FloatRect& sourceRect, const FloatSize& shadowOffset, float shadowBlur);
         void drawTiledShadow(const IntRect& rect, const FloatSize& topLeftRadius, const FloatSize& topRightRadius, const FloatSize& bottomLeftRadius, const FloatSize& bottomRightRadius, ColorSpace colorSpace);
diff --git a/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp b/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
index 7721ccc..e94dfba 100644
--- a/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
+++ b/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
@@ -610,20 +610,6 @@ static void drawBorderlessRectShadow(GraphicsContext* context, const FloatRect&
     if (!context->getShadow(shadowOffset, shadowBlur, shadowColor))
         return;
 
-    AffineTransform transform = context->getCTM();
-    // drawTiledShadow still does not work with rotations.
-    if ((transform.isIdentityOrTranslationOrFlipped())) {
-        cairo_t* cr = context->platformContext();
-        cairo_save(cr);
-        appendWebCorePathToCairoContext(cr, Path::createRectangle(rect));
-        FloatSize corner;
-        IntRect shadowRect(rect);
-        context->drawTiledShadow(shadowRect, corner, corner, corner, corner, DeviceColorSpace);
-        cairo_restore(cr);
-
-        return;
-    }
-
     IntSize shadowBufferSize;
     FloatRect shadowRect;
     float radius = 0;
@@ -920,7 +906,7 @@ void GraphicsContext::setPlatformShadow(FloatSize const& size, float, Color cons
     }
 }
 
-void GraphicsContext::applyPlatformShadow(PassOwnPtr<ImageBuffer> buffer, const Color& shadowColor, const FloatRect& shadowRect, float radius)
+void GraphicsContext::applyPlatformShadow(PassOwnPtr<ImageBuffer> buffer, const Color& shadowColor, FloatRect& shadowRect, float radius)
 {
 #if ENABLE(FILTERS)
     setColor(m_data->cr, shadowColor);
@@ -929,7 +915,7 @@ void GraphicsContext::applyPlatformShadow(PassOwnPtr<ImageBuffer> buffer, const
 #endif
 }
 
-PlatformRefPtr<cairo_surface_t> GraphicsContext::createShadowMask(PassOwnPtr<ImageBuffer> buffer, const FloatRect& shadowRect, float radius)
+PlatformRefPtr<cairo_surface_t> GraphicsContext::createShadowMask(PassOwnPtr<ImageBuffer> buffer, FloatRect& shadowRect, float radius)
 {
 #if ENABLE(FILTERS)
     if (!radius)
@@ -941,16 +927,20 @@ PlatformRefPtr<cairo_surface_t> GraphicsContext::createShadowMask(PassOwnPtr<Ima
         return buffer->m_data.m_surface;
 
     // create filter
-    RefPtr<Filter> filter = ImageBufferFilter::create();
+    IntRect filterRegion = IntRect(IntPoint(), roundedIntSize(shadowRect.size()));
+    RefPtr<Filter> filter = ImageBufferFilter::create(filterRegion);
     filter->setSourceImage(buffer);
     RefPtr<FilterEffect> source = SourceGraphic::create();
-    source->setAbsolutePaintRect(IntRect(IntPoint(), roundedIntSize(shadowRect.size())));
     source->setIsAlphaImage(true);
     RefPtr<FilterEffect> blur = FEGaussianBlur::create(stdDeviation, stdDeviation);
+    blur->setMaxEffectRect(filterRegion);
     FilterEffectVector& inputEffects = blur->inputEffects();
     inputEffects.append(source.get());
-    blur->setAbsolutePaintRect(IntRect(IntPoint(), roundedIntSize(shadowRect.size())));
     blur->apply(filter.get());
+
+    // Calculate shadow region for context
+    shadowRect.move(blur->absolutePaintRect().location().x(), blur->absolutePaintRect().location().y());
+    shadowRect.setSize(blur->absolutePaintRect().size());
     return blur->resultImage()->m_data.m_surface;
 #endif
 }
@@ -1280,7 +1270,7 @@ void GraphicsContext::drawTiledShadow(const IntRect& rect, const FloatSize& topL
     if (!smallBuffer)
         return;
 
-    IntRect smallRect = IntRect(blurRadius, blurRadius, smallBufferSize.width() - radiusTwice, smallBufferSize.height() - radiusTwice);
+    FloatRect smallRect = FloatRect(blurRadius, blurRadius, smallBufferSize.width() - radiusTwice, smallBufferSize.height() - radiusTwice);
 
     // Draw shadow into a new ImageBuffer.
     cairo_t* smallBufferContext = smallBuffer->context()->platformContext();
@@ -1385,12 +1375,7 @@ void GraphicsContext::fillRoundedRect(const IntRect& r, const IntSize& topLeft,
     cairo_save(cr);
     appendWebCorePathToCairoContext(cr, Path::createRoundedRectangle(r, topLeft, topRight, bottomLeft, bottomRight));
     setColor(cr, color);
-    AffineTransform transform = this->getCTM();
-    // drawTiledShadow still does not work with rotations.
-    if (transform.isIdentityOrTranslationOrFlipped())
-        drawTiledShadow(r, topLeft, topRight, bottomLeft, bottomRight, colorSpace);
-    else
-        drawPathShadow(this, m_common, true, false);
+    drawPathShadow(this, m_common, true, false);
     cairo_fill(cr);
     cairo_restore(cr);
 }
diff --git a/WebCore/platform/graphics/filters/ImageBufferFilter.cpp b/WebCore/platform/graphics/filters/ImageBufferFilter.cpp
index 12407f8..0237977 100644
--- a/WebCore/platform/graphics/filters/ImageBufferFilter.cpp
+++ b/WebCore/platform/graphics/filters/ImageBufferFilter.cpp
@@ -27,15 +27,16 @@
 
 namespace WebCore {
 
-ImageBufferFilter::ImageBufferFilter()
+ImageBufferFilter::ImageBufferFilter(const FloatRect& sourceImageRect)
     : Filter()
+    , m_sourceImageRect(sourceImageRect)
 {
-    setFilterResolution(FloatSize(1.f, 1.f));
+    setFilterResolution(FloatSize(1, 1));
 }
 
-PassRefPtr<ImageBufferFilter> ImageBufferFilter::create()
+PassRefPtr<ImageBufferFilter> ImageBufferFilter::create(const FloatRect& sourceImageRect)
 {
-    return adoptRef(new ImageBufferFilter());
+    return adoptRef(new ImageBufferFilter(sourceImageRect));
 }
 
 } // namespace WebCore
diff --git a/WebCore/platform/graphics/filters/ImageBufferFilter.h b/WebCore/platform/graphics/filters/ImageBufferFilter.h
index cd4bc2f..5a37214 100644
--- a/WebCore/platform/graphics/filters/ImageBufferFilter.h
+++ b/WebCore/platform/graphics/filters/ImageBufferFilter.h
@@ -35,10 +35,10 @@ namespace WebCore {
 
 class ImageBufferFilter : public Filter {
 public:
-    static PassRefPtr<ImageBufferFilter> create();
+    static PassRefPtr<ImageBufferFilter> create(const FloatRect&);
 
-    virtual FloatRect filterRegion() const { return FloatRect(); }
-    virtual FloatRect sourceImageRect() const { return FloatRect(); }
+    virtual FloatRect filterRegion() const { return m_sourceImageRect; }
+    virtual FloatRect sourceImageRect() const { return m_sourceImageRect; }
 
     // SVG specific
     virtual bool effectBoundingBoxMode() const { return false; }
@@ -47,7 +47,9 @@ public:
     virtual void calculateEffectSubRegion(FilterEffect*) { }
 
 private:
-    ImageBufferFilter();
+    ImageBufferFilter(const FloatRect&);
+
+    FloatRect m_sourceImageRect;
 };
 
 } // namespace WebCore

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list