Title: [120467] trunk
Revision
120467
Author
fmal...@chromium.org
Date
2012-06-15 08:56:18 -0700 (Fri, 15 Jun 2012)

Log Message

Specular light filters produce dark results
https://bugs.webkit.org/show_bug.cgi?id=89116

Reviewed by Dirk Schulze.

Source/WebCore:

Tests: svg/filters/feSpecularLight-premultiplied-expected.svg
       svg/filters/feSpecularLight-premultiplied.svg

Per spec (http://www.w3.org/TR/SVG/filters.html#feSpecularLightingElement),
light filters should operate on pre-multiplied RGBA. Currently, the results
are stored in the unmultiplied buffer but the alpha channel is calculated
for premultiplied values (which causes a darkening of the result upon the
subsequent unmultiplied->premultiplied conversion). This patch updates
FELighting to generate premultiplied results.

* platform/graphics/filters/FELighting.cpp:
(WebCore::FELighting::platformApplySoftware):

LayoutTests:

* platform/chromium-linux/svg/W3C-SVG-1.1/filters-specular-01-f-expected.png:
* platform/chromium-linux/svg/dynamic-updates/SVGFESpecularLightingElement-dom-in-attr-expected.png:
* platform/chromium-linux/svg/dynamic-updates/SVGFESpecularLightingElement-dom-specularConstant-attr-expected.png:
* platform/chromium-linux/svg/dynamic-updates/SVGFESpecularLightingElement-dom-specularExponent-attr-expected.png:
* platform/chromium-linux/svg/dynamic-updates/SVGFESpecularLightingElement-dom-suraceScale-attr-expected.png:
* platform/chromium-linux/svg/dynamic-updates/SVGFESpecularLightingElement-inherit-lighting-color-css-prop-expected.png:
* platform/chromium-linux/svg/dynamic-updates/SVGFESpecularLightingElement-lighting-color-css-prop-expected.png:
* platform/chromium-linux/svg/dynamic-updates/SVGFESpecularLightingElement-svgdom-in-prop-expected.png:
* platform/chromium-linux/svg/dynamic-updates/SVGFESpecularLightingElement-svgdom-specularConstant-prop-expected.png:
* platform/chromium-linux/svg/dynamic-updates/SVGFESpecularLightingElement-svgdom-specularExponent-prop-expected.png:
* platform/chromium-linux/svg/dynamic-updates/SVGFESpecularLightingElement-svgdom-suraceScale-prop-expected.png:
* platform/chromium-linux/svg/filters/feLighting-crash-expected.png:
* platform/chromium/TestExpectations:
* platform/mac/TestExpectations:
* svg/filters/feSpecularLight-premultiplied-expected.svg: Added.
* svg/filters/feSpecularLight-premultiplied.svg: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (120466 => 120467)


--- trunk/LayoutTests/ChangeLog	2012-06-15 15:56:08 UTC (rev 120466)
+++ trunk/LayoutTests/ChangeLog	2012-06-15 15:56:18 UTC (rev 120467)
@@ -1,3 +1,27 @@
+2012-06-15  Florin Malita  <fmal...@chromium.org>
+
+        Specular light filters produce dark results
+        https://bugs.webkit.org/show_bug.cgi?id=89116
+
+        Reviewed by Dirk Schulze.
+
+        * platform/chromium-linux/svg/W3C-SVG-1.1/filters-specular-01-f-expected.png:
+        * platform/chromium-linux/svg/dynamic-updates/SVGFESpecularLightingElement-dom-in-attr-expected.png:
+        * platform/chromium-linux/svg/dynamic-updates/SVGFESpecularLightingElement-dom-specularConstant-attr-expected.png:
+        * platform/chromium-linux/svg/dynamic-updates/SVGFESpecularLightingElement-dom-specularExponent-attr-expected.png:
+        * platform/chromium-linux/svg/dynamic-updates/SVGFESpecularLightingElement-dom-suraceScale-attr-expected.png:
+        * platform/chromium-linux/svg/dynamic-updates/SVGFESpecularLightingElement-inherit-lighting-color-css-prop-expected.png:
+        * platform/chromium-linux/svg/dynamic-updates/SVGFESpecularLightingElement-lighting-color-css-prop-expected.png:
+        * platform/chromium-linux/svg/dynamic-updates/SVGFESpecularLightingElement-svgdom-in-prop-expected.png:
+        * platform/chromium-linux/svg/dynamic-updates/SVGFESpecularLightingElement-svgdom-specularConstant-prop-expected.png:
+        * platform/chromium-linux/svg/dynamic-updates/SVGFESpecularLightingElement-svgdom-specularExponent-prop-expected.png:
+        * platform/chromium-linux/svg/dynamic-updates/SVGFESpecularLightingElement-svgdom-suraceScale-prop-expected.png:
+        * platform/chromium-linux/svg/filters/feLighting-crash-expected.png:
+        * platform/chromium/TestExpectations:
+        * platform/mac/TestExpectations:
+        * svg/filters/feSpecularLight-premultiplied-expected.svg: Added.
+        * svg/filters/feSpecularLight-premultiplied.svg: Added.
+
 2012-06-15  Stephen Chenney  <schen...@chromium.org>
 
         SVG Composite of Offset filters incorrectly clips

Modified: trunk/LayoutTests/platform/chromium/TestExpectations (120466 => 120467)


--- trunk/LayoutTests/platform/chromium/TestExpectations	2012-06-15 15:56:08 UTC (rev 120466)
+++ trunk/LayoutTests/platform/chromium/TestExpectations	2012-06-15 15:56:18 UTC (rev 120467)
@@ -1235,6 +1235,20 @@
 BUGWK81217 WIN : svg/carto.net/tabgroup.svg = IMAGE
 BUGWK81217 : svg/hixie/perf/003.xml = PASS IMAGE
 
+// Need rebaseline after https://bugs.webkit.org/show_bug.cgi?id=89116
+BUGWK89116 WIN MAC : svg/W3C-SVG-1.1/filters-specular-01-f.svg = PASS IMAGE
+BUGWK89116 WIN MAC : svg/dynamic-updates/SVGFESpecularLightingElement-dom-in-attr.html = PASS IMAGE
+BUGWK89116 WIN MAC : svg/dynamic-updates/SVGFESpecularLightingElement-dom-specularConstant-attr.html = PASS IMAGE
+BUGWK89116 WIN MAC : svg/dynamic-updates/SVGFESpecularLightingElement-dom-specularExponent-attr.html = PASS IMAGE
+BUGWK89116 WIN MAC : svg/dynamic-updates/SVGFESpecularLightingElement-dom-suraceScale-attr.html = PASS IMAGE
+BUGWK89116 WIN MAC : svg/dynamic-updates/SVGFESpecularLightingElement-inherit-lighting-color-css-prop.html = PASS IMAGE
+BUGWK89116 WIN MAC : svg/dynamic-updates/SVGFESpecularLightingElement-lighting-color-css-prop.html = PASS IMAGE
+BUGWK89116 WIN MAC : svg/dynamic-updates/SVGFESpecularLightingElement-svgdom-in-prop.html = PASS IMAGE
+BUGWK89116 WIN MAC : svg/dynamic-updates/SVGFESpecularLightingElement-svgdom-specularConstant-prop.html = PASS IMAGE
+BUGWK89116 WIN MAC : svg/dynamic-updates/SVGFESpecularLightingElement-svgdom-specularExponent-prop.html = PASS IMAGE
+BUGWK89116 WIN MAC : svg/dynamic-updates/SVGFESpecularLightingElement-svgdom-suraceScale-prop.html = PASS IMAGE
+BUGWK89116 WIN MAC : svg/filters/feLighting-crash.svg = PASS IMAGE
+
 BUGWK81240 MAC : svg/text/bidi-reorder-value-lists.svg = PASS IMAGE+TEXT
 
 BUGWK81243 : svg/repaint/repainting-after-animation-element-removal.svg = PASS IMAGE

Modified: trunk/LayoutTests/platform/chromium-linux/svg/W3C-SVG-1.1/filters-specular-01-f-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/platform/chromium-linux/svg/dynamic-updates/SVGFESpecularLightingElement-dom-in-attr-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/platform/chromium-linux/svg/dynamic-updates/SVGFESpecularLightingElement-dom-specularConstant-attr-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/platform/chromium-linux/svg/dynamic-updates/SVGFESpecularLightingElement-dom-specularExponent-attr-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/platform/chromium-linux/svg/dynamic-updates/SVGFESpecularLightingElement-dom-suraceScale-attr-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/platform/chromium-linux/svg/dynamic-updates/SVGFESpecularLightingElement-inherit-lighting-color-css-prop-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/platform/chromium-linux/svg/dynamic-updates/SVGFESpecularLightingElement-lighting-color-css-prop-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/platform/chromium-linux/svg/dynamic-updates/SVGFESpecularLightingElement-svgdom-in-prop-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/platform/chromium-linux/svg/dynamic-updates/SVGFESpecularLightingElement-svgdom-specularConstant-prop-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/platform/chromium-linux/svg/dynamic-updates/SVGFESpecularLightingElement-svgdom-specularExponent-prop-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/platform/chromium-linux/svg/dynamic-updates/SVGFESpecularLightingElement-svgdom-suraceScale-prop-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/platform/chromium-linux/svg/filters/feLighting-crash-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/platform/mac/TestExpectations (120466 => 120467)


--- trunk/LayoutTests/platform/mac/TestExpectations	2012-06-15 15:56:08 UTC (rev 120466)
+++ trunk/LayoutTests/platform/mac/TestExpectations	2012-06-15 15:56:18 UTC (rev 120467)
@@ -211,6 +211,20 @@
 
 BUGWK85408 : svg/batik/text/longTextOnPath.svg = TEXT PASS
 
+// Need rebaseline after https://bugs.webkit.org/show_bug.cgi?id=89116
+BUGWK89116 : svg/W3C-SVG-1.1/filters-specular-01-f.svg = PASS IMAGE
+BUGWK89116 : svg/dynamic-updates/SVGFESpecularLightingElement-dom-in-attr.html = PASS IMAGE
+BUGWK89116 : svg/dynamic-updates/SVGFESpecularLightingElement-dom-specularConstant-attr.html = PASS IMAGE
+BUGWK89116 : svg/dynamic-updates/SVGFESpecularLightingElement-dom-specularExponent-attr.html = PASS IMAGE
+BUGWK89116 : svg/dynamic-updates/SVGFESpecularLightingElement-dom-suraceScale-attr.html = PASS IMAGE
+BUGWK89116 : svg/dynamic-updates/SVGFESpecularLightingElement-inherit-lighting-color-css-prop.html = PASS IMAGE
+BUGWK89116 : svg/dynamic-updates/SVGFESpecularLightingElement-lighting-color-css-prop.html = PASS IMAGE
+BUGWK89116 : svg/dynamic-updates/SVGFESpecularLightingElement-svgdom-in-prop.html = PASS IMAGE
+BUGWK89116 : svg/dynamic-updates/SVGFESpecularLightingElement-svgdom-specularConstant-prop.html = PASS IMAGE
+BUGWK89116 : svg/dynamic-updates/SVGFESpecularLightingElement-svgdom-specularExponent-prop.html = PASS IMAGE
+BUGWK89116 : svg/dynamic-updates/SVGFESpecularLightingElement-svgdom-suraceScale-prop.html = PASS IMAGE
+BUGWK89116 : svg/filters/feLighting-crash.svg = PASS IMAGE
+
 // Needs rebaseline after https://bugs.webkit.org/show_bug.cgi?id=79682
 BUGWK79682 : svg/repaint/text-mask-update.svg = MISSING IMAGE+TEXT IMAGE TEXT PASS
 

Added: trunk/LayoutTests/svg/filters/feSpecularLight-premultiplied-expected.svg (0 => 120467)


--- trunk/LayoutTests/svg/filters/feSpecularLight-premultiplied-expected.svg	                        (rev 0)
+++ trunk/LayoutTests/svg/filters/feSpecularLight-premultiplied-expected.svg	2012-06-15 15:56:18 UTC (rev 120467)
@@ -0,0 +1,4 @@
+<?xml version="1.0" standalone="no"?>
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1">
+    <rect width="100" height="100" fill="#00ff00"/>
+</svg>

Added: trunk/LayoutTests/svg/filters/feSpecularLight-premultiplied.svg (0 => 120467)


--- trunk/LayoutTests/svg/filters/feSpecularLight-premultiplied.svg	                        (rev 0)
+++ trunk/LayoutTests/svg/filters/feSpecularLight-premultiplied.svg	2012-06-15 15:56:18 UTC (rev 120467)
@@ -0,0 +1,31 @@
+<?xml version="1.0" standalone="no"?>
+<!-- Test for https://bugs.webkit.org/show_bug.cgi?id=89116 -->
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1">
+    <defs>
+      <filter id = "f1">
+          <feGaussianBlur in="SourceAlpha" stdDeviation="20" result = "blur1"/>
+          <feSpecularLighting result="specOut" in="blur1" specularExponent="20" lighting-color="#00ff00">
+              <fePointLight x="200" y="200" z="300"/>
+          </feSpecularLighting>
+          <feComposite in="SourceGraphic" in2="specOut" operator="arithmetic" k1="0" k2="1" k3="1" k4="0"/>
+      </filter>
+      <mask id="m1">
+        <rect width="100" height="100" fill="white"/>
+      </mask>
+    </defs>
+
+    <rect width="100" height="100" fill="#00ff00"/>
+    <!--
+      To avoid having platform specific results:
+        * apply the lighting filter to the 200x200 group
+        * mask the top-left 100x100 square
+        * since the filter target has no data in that area, the masked filter
+          result should only contain semi-transparent light color (#00ff00)
+        * overlaying #00ff00 on top of the green rectangle above should have no
+          effect -> hence we can use a ref-test
+    -->
+    <g filter="url(#f1)" mask="url(#m1)">
+      <rect x="150" y="0" width="50" height="200" fill="black"/>
+      <rect x="0" y="150" width="200" height="50" fill="black"/>
+    </g>
+</svg>

Modified: trunk/Source/WebCore/ChangeLog (120466 => 120467)


--- trunk/Source/WebCore/ChangeLog	2012-06-15 15:56:08 UTC (rev 120466)
+++ trunk/Source/WebCore/ChangeLog	2012-06-15 15:56:18 UTC (rev 120467)
@@ -1,3 +1,23 @@
+2012-06-15  Florin Malita  <fmal...@chromium.org>
+
+        Specular light filters produce dark results
+        https://bugs.webkit.org/show_bug.cgi?id=89116
+
+        Reviewed by Dirk Schulze.
+
+        Tests: svg/filters/feSpecularLight-premultiplied-expected.svg
+               svg/filters/feSpecularLight-premultiplied.svg
+
+        Per spec (http://www.w3.org/TR/SVG/filters.html#feSpecularLightingElement),
+        light filters should operate on pre-multiplied RGBA. Currently, the results
+        are stored in the unmultiplied buffer but the alpha channel is calculated
+        for premultiplied values (which causes a darkening of the result upon the
+        subsequent unmultiplied->premultiplied conversion). This patch updates
+        FELighting to generate premultiplied results.
+
+        * platform/graphics/filters/FELighting.cpp:
+        (WebCore::FELighting::platformApplySoftware):
+
 2012-06-15  Andrey Kosyakov  <ca...@chromium.org>
 
         Web Inspector: incorrect filtering of async timeline events

Modified: trunk/Source/WebCore/platform/graphics/filters/FELighting.cpp (120466 => 120467)


--- trunk/Source/WebCore/platform/graphics/filters/FELighting.cpp	2012-06-15 15:56:08 UTC (rev 120466)
+++ trunk/Source/WebCore/platform/graphics/filters/FELighting.cpp	2012-06-15 15:56:18 UTC (rev 120467)
@@ -388,14 +388,14 @@
 {
     FilterEffect* in = inputEffect(0);
 
-    Uint8ClampedArray* srcPixelArray = createUnmultipliedImageResult();
+    Uint8ClampedArray* srcPixelArray = createPremultipliedImageResult();
     if (!srcPixelArray)
         return;
 
     setIsAlphaImage(false);
 
     IntRect effectDrawingRect = requestedRegionOfInputImageData(in->absolutePaintRect());
-    in->copyUnmultipliedImage(srcPixelArray, effectDrawingRect);
+    in->copyPremultipliedImage(srcPixelArray, effectDrawingRect);
 
     // FIXME: support kernelUnitLengths other than (1,1). The issue here is that the W3
     // standard has no test case for them, and other browsers (like Firefox) has strange
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to