[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.15.1-1414-gc69ee75

krit at webkit.org krit at webkit.org
Thu Oct 29 20:39:48 UTC 2009


The following commit has been merged in the webkit-1.1 branch:
commit e6c5c28b2bcd1570c378ecf7bc083f617dbdc5bf
Author: krit at webkit.org <krit at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Oct 6 05:58:44 2009 +0000

    2009-10-05  Dirk Schulze  <krit at webkit.org>
    
            Reviewed by Nikolas Zimmermann.
    
            SVG Filters do not support source images besides "sourceGraphic"
            [https://bugs.webkit.org/show_bug.cgi?id=6022]
    
            Add support for SourceAlpha to SVG filters.
    
            Test: svg/filters/sourceAlpha.svg
    
            * platform/graphics/filters/SourceAlpha.cpp:
            (WebCore::SourceAlpha::calculateEffectRect):
            (WebCore::SourceAlpha::apply):
            * platform/graphics/filters/SourceAlpha.h:
    
            Test for SVG's SourceAlpha support for Filters.
    
            * platform/mac/svg/filters/sourceAlpha-expected.checksum: Added.
            * platform/mac/svg/filters/sourceAlpha-expected.png: Added.
            * platform/mac/svg/filters/sourceAlpha-expected.txt: Added.
            * svg/filters/sourceAlpha.svg: Added.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@49153 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index a2ca8f2..07902d5 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,14 @@
+2009-10-05  Dirk Schulze  <krit at webkit.org>
+
+        Reviewed by Nikolas Zimmermann.
+
+        Test for SVG's SourceAlpha support for Filters.
+
+        * platform/mac/svg/filters/sourceAlpha-expected.checksum: Added.
+        * platform/mac/svg/filters/sourceAlpha-expected.png: Added.
+        * platform/mac/svg/filters/sourceAlpha-expected.txt: Added.
+        * svg/filters/sourceAlpha.svg: Added.
+
 2009-10-05  Simon Fraser  <simon.fraser at apple.com>
 
         Updated results for media tests after controller change to add the fullscreen button. 
diff --git a/LayoutTests/platform/mac/svg/filters/sourceAlpha-expected.checksum b/LayoutTests/platform/mac/svg/filters/sourceAlpha-expected.checksum
new file mode 100644
index 0000000..ecd7f36
--- /dev/null
+++ b/LayoutTests/platform/mac/svg/filters/sourceAlpha-expected.checksum
@@ -0,0 +1 @@
+fdc9d57433dcba1b30c437434ce342e7
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/svg/filters/sourceAlpha-expected.png b/LayoutTests/platform/mac/svg/filters/sourceAlpha-expected.png
new file mode 100644
index 0000000..79a1557
Binary files /dev/null and b/LayoutTests/platform/mac/svg/filters/sourceAlpha-expected.png differ
diff --git a/LayoutTests/platform/mac/svg/filters/sourceAlpha-expected.txt b/LayoutTests/platform/mac/svg/filters/sourceAlpha-expected.txt
new file mode 100644
index 0000000..228a47d
--- /dev/null
+++ b/LayoutTests/platform/mac/svg/filters/sourceAlpha-expected.txt
@@ -0,0 +1,10 @@
+KCanvasResource {id="filter" [type=FILTER]  [bounding box=at (-10.00%,-10.00%) size 120.00%x120.00%]}
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderSVGRoot {svg} at (42,9.40) size 96x55.20
+    RenderSVGHiddenContainer {defs} at (0,0) size 0x0
+    RenderSVGContainer {g} at (42,9.40) size 96x55.20 [filter=filter]
+      RenderSVGText {text} at (50,50) size 80x46 contains 1 chunk(s)
+        RenderSVGInlineText {#text} at (0,-36) size 80x46
+          chunk 1 text run 1 at (50.00,50.00) startOffset 0 endOffset 3 width 80.00: "SVG"
diff --git a/LayoutTests/svg/filters/sourceAlpha.svg b/LayoutTests/svg/filters/sourceAlpha.svg
new file mode 100644
index 0000000..f2c0b33
--- /dev/null
+++ b/LayoutTests/svg/filters/sourceAlpha.svg
@@ -0,0 +1,8 @@
+<svg xmlns="http://www.w3.org/2000/svg">
+<defs>
+<filter id="filter">
+<feOffset in="SourceAlpha"/>
+</filter>
+</defs>
+<g filter="url(#filter)"><text x="50" y="50" style="font-size:40px;fill:red;fill-opacity:0.5">SVG</text></g>
+</svg>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 9ccde15..222d9dd 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,19 @@
+2009-10-05  Dirk Schulze  <krit at webkit.org>
+
+        Reviewed by Nikolas Zimmermann.
+
+        SVG Filters do not support source images besides "sourceGraphic"
+        [https://bugs.webkit.org/show_bug.cgi?id=6022]
+
+        Add support for SourceAlpha to SVG filters.
+
+        Test: svg/filters/sourceAlpha.svg
+
+        * platform/graphics/filters/SourceAlpha.cpp:
+        (WebCore::SourceAlpha::calculateEffectRect):
+        (WebCore::SourceAlpha::apply):
+        * platform/graphics/filters/SourceAlpha.h:
+
 2009-10-05  John Abd-El-Malek  <jam at chromium.org>
 
         Reviewed by Adam Barth.
diff --git a/WebCore/platform/graphics/filters/SourceAlpha.cpp b/WebCore/platform/graphics/filters/SourceAlpha.cpp
index 646a57b..57436be 100644
--- a/WebCore/platform/graphics/filters/SourceAlpha.cpp
+++ b/WebCore/platform/graphics/filters/SourceAlpha.cpp
@@ -22,6 +22,7 @@
 #if ENABLE(FILTERS)
 #include "SourceAlpha.h"
 
+#include "Color.h"
 #include "GraphicsContext.h"
 #include "PlatformString.h"
 #include "Filter.h"
@@ -41,8 +42,28 @@ const AtomicString& SourceAlpha::effectName()
     return s_effectName;
 }
 
-void SourceAlpha::apply(Filter*)
+FloatRect SourceAlpha::calculateEffectRect(Filter* filter)
 {
+    FloatRect clippedSourceRect = filter->sourceImageRect();
+    if (filter->sourceImageRect().x() < filter->filterRegion().x())
+        clippedSourceRect.setX(filter->filterRegion().x());
+    if (filter->sourceImageRect().y() < filter->filterRegion().y())
+        clippedSourceRect.setY(filter->filterRegion().y());
+    setSubRegion(clippedSourceRect);
+    return filter->filterRegion();
+}
+
+void SourceAlpha::apply(Filter* filter)
+{
+    GraphicsContext* filterContext = getEffectContext();
+    if (!filterContext)
+        return;
+
+    FloatRect imageRect(FloatPoint(), filter->sourceImage()->image()->size());
+    filterContext->save();
+    filterContext->clipToImageBuffer(imageRect, filter->sourceImage());
+    filterContext->fillRect(imageRect, Color::black);
+    filterContext->restore();
 }
 
 void SourceAlpha::dump()
diff --git a/WebCore/platform/graphics/filters/SourceAlpha.h b/WebCore/platform/graphics/filters/SourceAlpha.h
index 5341562..172d05a 100644
--- a/WebCore/platform/graphics/filters/SourceAlpha.h
+++ b/WebCore/platform/graphics/filters/SourceAlpha.h
@@ -35,7 +35,7 @@ namespace WebCore {
         static const AtomicString& effectName();
 
         virtual bool isSourceInput() { return true; }
-        virtual FloatRect calculateEffectRect(Filter* filter) { return filter->sourceImageRect(); }
+        virtual FloatRect calculateEffectRect(Filter*);
         void apply(Filter*);
         void dump();
     

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list