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

zimmermann at webkit.org zimmermann at webkit.org
Wed Dec 22 12:22:26 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 58675cfda4ee7d799ee59a82623a197a1bfa03ed
Author: zimmermann at webkit.org <zimmermann at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Aug 20 09:13:49 2010 +0000

    2010-08-20  Nikolas Zimmermann  <nzimmermann at rim.com>
    
            Reviewed by Dirk Schulze.
    
            Clippers are rasterized, when applied to scaled target object
            https://bugs.webkit.org/show_bug.cgi?id=44325
    
            Use SVGImageBufferTools logic for RenderSVGResourceClipper, just like RenderSVGResourceMasker/Gradient,
            to avoid pixelation, when the clipper is applied to a scaled target object, or when the document is scaled.
    
            Test: svg/clip-path/clip-path-pixelation.svg
    
            * rendering/RenderSVGResourceClipper.cpp:
            (WebCore::RenderSVGResourceClipper::applyClippingToContext):
            (WebCore::RenderSVGResourceClipper::createClipData):
            * rendering/RenderSVGResourceClipper.h:
    
    2010-08-20  Nikolas Zimmermann  <nzimmermann at rim.com>
    
            Reviewed by Dirk Schulze.
    
            Clippers are rasterized, when applied to scaled target object
            https://bugs.webkit.org/show_bug.cgi?id=44325
    
            * platform/mac/svg/clip-path/clip-path-pixelation-expected.checksum: Added.
            * platform/mac/svg/clip-path/clip-path-pixelation-expected.png: Added.
            * platform/mac/svg/clip-path/clip-path-pixelation-expected.txt: Added.
            * svg/clip-path/clip-path-pixelation.svg: Added.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@65729 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 48315ab..65a21a8 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,15 @@
+2010-08-20  Nikolas Zimmermann  <nzimmermann at rim.com>
+
+        Reviewed by Dirk Schulze.
+
+        Clippers are rasterized, when applied to scaled target object
+        https://bugs.webkit.org/show_bug.cgi?id=44325
+
+        * platform/mac/svg/clip-path/clip-path-pixelation-expected.checksum: Added.
+        * platform/mac/svg/clip-path/clip-path-pixelation-expected.png: Added.
+        * platform/mac/svg/clip-path/clip-path-pixelation-expected.txt: Added.
+        * svg/clip-path/clip-path-pixelation.svg: Added.
+
 2010-08-19  Kent Tamura  <tkent at chromium.org>
 
         Unreviewed, test expectation update.
diff --git a/LayoutTests/platform/mac/svg/clip-path/clip-path-pixelation-expected.checksum b/LayoutTests/platform/mac/svg/clip-path/clip-path-pixelation-expected.checksum
new file mode 100644
index 0000000..5ac55f3
--- /dev/null
+++ b/LayoutTests/platform/mac/svg/clip-path/clip-path-pixelation-expected.checksum
@@ -0,0 +1 @@
+f8e9ea02cdcf2a336de28bfaa99341cb
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/svg/clip-path/clip-path-pixelation-expected.png b/LayoutTests/platform/mac/svg/clip-path/clip-path-pixelation-expected.png
new file mode 100644
index 0000000..682bb0f
Binary files /dev/null and b/LayoutTests/platform/mac/svg/clip-path/clip-path-pixelation-expected.png differ
diff --git a/LayoutTests/platform/mac/svg/clip-path/clip-path-pixelation-expected.txt b/LayoutTests/platform/mac/svg/clip-path/clip-path-pixelation-expected.txt
new file mode 100644
index 0000000..5b8a12d
--- /dev/null
+++ b/LayoutTests/platform/mac/svg/clip-path/clip-path-pixelation-expected.txt
@@ -0,0 +1,13 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderSVGRoot {svg} at (25,6) size 250x294
+    RenderSVGHiddenContainer {defs} at (0,0) size 0x0
+      RenderSVGResourceClipper {clipPath} [id="clip-circle"] [clipPathUnits=objectBoundingBox]
+        RenderPath {circle} at (0,0) size 1x1 [fill={[type=SOLID] [color=#000000]}] [data="M0.50,0.25 L0.50,0.27 L0.50,0.28 L0.50,0.30 L0.49,0.31 L0.49,0.33 L0.48,0.34 L0.48,0.36 L0.47,0.37 L0.46,0.38 L0.45,0.40 L0.44,0.41 L0.43,0.42 L0.42,0.43 L0.41,0.44 L0.40,0.45 L0.38,0.46 L0.37,0.47 L0.36,0.48 L0.34,0.48 L0.33,0.49 L0.31,0.49 L0.30,0.50 L0.28,0.50 L0.27,0.50 L0.25,0.50 L0.23,0.50 L0.22,0.50 L0.20,0.50 L0.19,0.49 L0.17,0.49 L0.16,0.48 L0.14,0.48 L0.13,0.47 L0.12,0.46 L0.10,0.45 L0.09,0.44 L0.08,0.43 L0.07,0.42 L0.06,0.41 L0.05,0.40 L0.04,0.38 L0.03,0.37 L0.02,0.36 L0.02,0.34 L0.01,0.33 L0.01,0.31 L0.00,0.30 L0.00,0.28 L0.00,0.27 L0.00,0.25 L0.00,0.23 L0.00,0.22 L0.00,0.20 L0.01,0.19 L0.01,0.17 L0.02,0.16 L0.02,0.14 L0.03,0.13 L0.04,0.12 L0.05,0.10 L0.06,0.09 L0.07,0.08 L0.08,0.07 L0.09,0.06 L0.10,0.05 L0.12,0.04 L0.13,0.03 L0.14,0.02 L0.16,0.02 L0.17,0.01 L0.19,0.01 L0.20,0.00 L0.22,0.00 L0.23,0.00 L0.25,0.00 L0.27,0.00 L0.28,0.00 L0.30,0.00 L0.31,0.01 L0.33,0.01 L0.34,0.02 L0.36,0.02 L0.37,0.03 L0.38,0.04 L0.40,0.05 L0.41,0.06 L0.42,0.07 L0.43,0.08 L0.44,0.09 L0.45,0.10 L0.46,0.12 L0.47,0.13 L0.48,0.14 L0.48,0.16 L0.49,0.17 L0.49,0.19 L0.50,0.20 L0.50,0.22 L0.50,0.23 Z"]
+        RenderPath {circle} at (0,0) size 1x1 [fill={[type=SOLID] [color=#000000]}] [data="M1.00,0.75 L1.00,0.77 L1.00,0.78 L1.00,0.80 L0.99,0.81 L0.99,0.83 L0.98,0.84 L0.98,0.86 L0.97,0.87 L0.96,0.88 L0.95,0.90 L0.94,0.91 L0.93,0.92 L0.92,0.93 L0.91,0.94 L0.90,0.95 L0.88,0.96 L0.87,0.97 L0.86,0.98 L0.84,0.98 L0.83,0.99 L0.81,0.99 L0.80,1.00 L0.78,1.00 L0.77,1.00 L0.75,1.00 L0.73,1.00 L0.72,1.00 L0.70,1.00 L0.69,0.99 L0.67,0.99 L0.66,0.98 L0.64,0.98 L0.63,0.97 L0.62,0.96 L0.60,0.95 L0.59,0.94 L0.58,0.93 L0.57,0.92 L0.56,0.91 L0.55,0.90 L0.54,0.88 L0.53,0.87 L0.52,0.86 L0.52,0.84 L0.51,0.83 L0.51,0.81 L0.50,0.80 L0.50,0.78 L0.50,0.77 L0.50,0.75 L0.50,0.73 L0.50,0.72 L0.50,0.70 L0.51,0.69 L0.51,0.67 L0.52,0.66 L0.52,0.64 L0.53,0.63 L0.54,0.62 L0.55,0.60 L0.56,0.59 L0.57,0.58 L0.58,0.57 L0.59,0.56 L0.60,0.55 L0.62,0.54 L0.63,0.53 L0.64,0.52 L0.66,0.52 L0.67,0.51 L0.69,0.51 L0.70,0.50 L0.72,0.50 L0.73,0.50 L0.75,0.50 L0.77,0.50 L0.78,0.50 L0.80,0.50 L0.81,0.51 L0.83,0.51 L0.84,0.52 L0.86,0.52 L0.87,0.53 L0.88,0.54 L0.90,0.55 L0.91,0.56 L0.92,0.57 L0.93,0.58 L0.94,0.59 L0.95,0.60 L0.96,0.62 L0.97,0.63 L0.98,0.64 L0.98,0.66 L0.99,0.67 L0.99,0.69 L1.00,0.70 L1.00,0.72 L1.00,0.73 Z"]
+    RenderSVGText {text} at (54,6) size 192x18 contains 1 chunk(s)
+      RenderSVGInlineText {#text} at (0,0) size 192x18
+        chunk 1 (middle anchor) text run 1 at (54.50,20.00) startOffset 0 endOffset 30 width 191.00: "This should not look pixelated"
+    RenderPath {rect} at (25,50) size 250x250 [transform={m=((25.00,0.00)(0.00,25.00)) t=(0.00,0.00)}] [fill={[type=SOLID] [color=#008000]}] [data="M1.00,2.00 L11.00,2.00 L11.00,12.00 L1.00,12.00 Z"]
+      [clipPath="clip-circle"] RenderSVGResourceClipper {clipPath} at (1,2) size 10x10
diff --git a/LayoutTests/svg/clip-path/clip-path-pixelation.svg b/LayoutTests/svg/clip-path/clip-path-pixelation.svg
new file mode 100644
index 0000000..b7d8ccb
--- /dev/null
+++ b/LayoutTests/svg/clip-path/clip-path-pixelation.svg
@@ -0,0 +1,11 @@
+<svg xmlns="http://www.w3.org/2000/svg">
+<defs>
+    <clipPath clipPathUnits="objectBoundingBox" id="clip-circle">
+        <circle cx="0.25" cy="0.25" r="0.25"/>
+        <circle cx="0.75" cy="0.75" r="0.25"/>
+    </clipPath>
+</defs>
+<text x="150" y="20" text-anchor="middle">This should not look pixelated</text>
+
+<rect id="rect" transform="scale(25 25)" clip-path="url(#clip-circle)" x="1" y="2" width="10" height="10" fill="green"/>
+</svg>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 71d8bdc..6c5389c 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,20 @@
+2010-08-20  Nikolas Zimmermann  <nzimmermann at rim.com>
+
+        Reviewed by Dirk Schulze.
+
+        Clippers are rasterized, when applied to scaled target object
+        https://bugs.webkit.org/show_bug.cgi?id=44325
+
+        Use SVGImageBufferTools logic for RenderSVGResourceClipper, just like RenderSVGResourceMasker/Gradient,
+        to avoid pixelation, when the clipper is applied to a scaled target object, or when the document is scaled.
+
+        Test: svg/clip-path/clip-path-pixelation.svg
+
+        * rendering/RenderSVGResourceClipper.cpp:
+        (WebCore::RenderSVGResourceClipper::applyClippingToContext):
+        (WebCore::RenderSVGResourceClipper::createClipData):
+        * rendering/RenderSVGResourceClipper.h:
+
 2010-08-20  Andreas Kling  <andreas.kling at nokia.com>
 
         Reviewed by Kenneth Rohde Christiansen.
diff --git a/WebCore/rendering/RenderSVGResourceClipper.cpp b/WebCore/rendering/RenderSVGResourceClipper.cpp
index 626a880..e8aa65e 100644
--- a/WebCore/rendering/RenderSVGResourceClipper.cpp
+++ b/WebCore/rendering/RenderSVGResourceClipper.cpp
@@ -37,6 +37,7 @@
 #include "RenderStyle.h"
 #include "SVGClipPathElement.h"
 #include "SVGElement.h"
+#include "SVGImageBufferTools.h"
 #include "SVGRenderSupport.h"
 #include "SVGResources.h"
 #include "SVGStyledElement.h"
@@ -163,32 +164,42 @@ bool RenderSVGResourceClipper::applyClippingToContext(RenderObject* object, cons
     if (!m_clipper.contains(object))
         m_clipper.set(object, new ClipperData);
 
+    bool shouldCreateClipData = false;
     ClipperData* clipperData = m_clipper.get(object);
     if (!clipperData->clipMaskImage) {
         if (pathOnlyClipping(context, objectBoundingBox))
             return true;
-        createClipData(clipperData, objectBoundingBox, repaintRect);
+        shouldCreateClipData = true;
     }
 
+    AffineTransform absoluteTransform = SVGImageBufferTools::transformationToOutermostSVGCoordinateSystem(object);
+    FloatRect clampedAbsoluteTargetRect = SVGImageBufferTools::clampedAbsoluteTargetRectForRenderer(object, absoluteTransform, repaintRect);
+
+    if (shouldCreateClipData)
+        createClipData(clipperData, objectBoundingBox, repaintRect, clampedAbsoluteTargetRect, absoluteTransform);
+
     if (!clipperData->clipMaskImage)
         return false;
 
-    context->clipToImageBuffer(clipperData->clipMaskImage.get(), repaintRect);
+    SVGImageBufferTools::clipToImageBuffer(context, absoluteTransform, clampedAbsoluteTargetRect, clipperData->clipMaskImage.get());
     return true;
 }
 
-bool RenderSVGResourceClipper::createClipData(ClipperData* clipperData, const FloatRect& objectBoundingBox, const FloatRect& repaintRect)
+bool RenderSVGResourceClipper::createClipData(ClipperData* clipperData,
+                                              const FloatRect& objectBoundingBox,
+                                              const FloatRect& repaintRect,
+                                              const FloatRect& clampedAbsoluteTargetRect,
+                                              const AffineTransform& absoluteTransform)
 {
-    IntRect clipMaskRect = enclosingIntRect(repaintRect);
-    clipperData->clipMaskImage = ImageBuffer::create(clipMaskRect.size());
-    if (!clipperData->clipMaskImage)
+    if (!SVGImageBufferTools::createImageBuffer(clampedAbsoluteTargetRect, clipperData->clipMaskImage, DeviceRGB))
         return false;
 
     GraphicsContext* maskContext = clipperData->clipMaskImage->context();
     ASSERT(maskContext);
 
     maskContext->save();
-    maskContext->translate(-repaintRect.x(), -repaintRect.y());
+    maskContext->translate(-clampedAbsoluteTargetRect.x(), -clampedAbsoluteTargetRect.y());
+    maskContext->concatCTM(absoluteTransform);
 
     // clipPath can also be clipped by another clipPath.
     if (SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(this)) {
diff --git a/WebCore/rendering/RenderSVGResourceClipper.h b/WebCore/rendering/RenderSVGResourceClipper.h
index 0f68c67..6ea1563 100644
--- a/WebCore/rendering/RenderSVGResourceClipper.h
+++ b/WebCore/rendering/RenderSVGResourceClipper.h
@@ -65,7 +65,8 @@ private:
     // applyResource directly and use the rects from the object, since they are empty for RenderSVGResources
     bool applyClippingToContext(RenderObject*, const FloatRect&, const FloatRect&, GraphicsContext*);
     bool pathOnlyClipping(GraphicsContext*, const FloatRect&);
-    bool createClipData(ClipperData*, const FloatRect&, const FloatRect&);
+    bool createClipData(ClipperData*, const FloatRect& objectBoundingBox, const FloatRect& repaintRect, const FloatRect& clampedAbsoluteTargetRect, const AffineTransform& absoluteTransform);
+
     void calculateClipContentRepaintRect();
 
     bool m_invalidationBlocked;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list