Title: [226316] trunk
Revision
226316
Author
[email protected]
Date
2018-01-01 12:28:32 -0800 (Mon, 01 Jan 2018)

Log Message

Bottom right pixel of feDiffuseLighting has the wrong color
https://bugs.webkit.org/show_bug.cgi?id=181203

Reviewed by Antti Koivisto.

Source/WebCore:

The lower right pixel of a feDiffuseLighting was the wrong color, because the kernel
values didn't match the spec for the bottom right Y values.

Test: svg/filters/feDiffuseLighting-bottomRightPixel.html

* platform/graphics/filters/FELighting.cpp:
(WebCore::FELighting::LightingData::bottomRightNormal const):

LayoutTests:

Test that draws an SVG image into a canvas, and scales it up without interpolation.

* svg/filters/feDiffuseLighting-bottomRightPixel-expected.html: Added.
* svg/filters/feDiffuseLighting-bottomRightPixel.html: Added.
* svg/filters/resources/feDiffuseLighting-rect.svg: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (226315 => 226316)


--- trunk/LayoutTests/ChangeLog	2018-01-01 19:53:39 UTC (rev 226315)
+++ trunk/LayoutTests/ChangeLog	2018-01-01 20:28:32 UTC (rev 226316)
@@ -1,3 +1,16 @@
+2017-12-31  Simon Fraser  <[email protected]>
+
+        Bottom right pixel of feDiffuseLighting has the wrong color
+        https://bugs.webkit.org/show_bug.cgi?id=181203
+
+        Reviewed by Antti Koivisto.
+
+        Test that draws an SVG image into a canvas, and scales it up without interpolation.
+
+        * svg/filters/feDiffuseLighting-bottomRightPixel-expected.html: Added.
+        * svg/filters/feDiffuseLighting-bottomRightPixel.html: Added.
+        * svg/filters/resources/feDiffuseLighting-rect.svg: Added.
+
 2017-12-30  Simon Fraser  <[email protected]>
 
         SVG lighting colors need to be converted into linearSRGB

Added: trunk/LayoutTests/svg/filters/feDiffuseLighting-bottomRightPixel-expected.html (0 => 226316)


--- trunk/LayoutTests/svg/filters/feDiffuseLighting-bottomRightPixel-expected.html	                        (rev 0)
+++ trunk/LayoutTests/svg/filters/feDiffuseLighting-bottomRightPixel-expected.html	2018-01-01 20:28:32 UTC (rev 226316)
@@ -0,0 +1 @@
+<div style="width: 200px; height: 200px; background-color: green"></div>

Added: trunk/LayoutTests/svg/filters/feDiffuseLighting-bottomRightPixel.html (0 => 226316)


--- trunk/LayoutTests/svg/filters/feDiffuseLighting-bottomRightPixel.html	                        (rev 0)
+++ trunk/LayoutTests/svg/filters/feDiffuseLighting-bottomRightPixel.html	2018-01-01 20:28:32 UTC (rev 226316)
@@ -0,0 +1,17 @@
+<canvas id="canvas" width="200" height="200"></canvas>
+<img id="image" src="" _onload_="drawIntoCanvas()" style="visibility:hidden">
+<script>
+if (window.testRunner)
+    testRunner.waitUntilDone();
+
+function drawIntoCanvas()
+{
+    var ctx = document.getElementById('canvas').getContext("2d");
+    var image = document.getElementById('image');
+    ctx.imageSmoothingEnabled = false;
+    ctx.drawImage(image, 0, 0, 200, 200);
+
+    if (window.testRunner)
+        testRunner.notifyDone();
+}
+</script>

Modified: trunk/LayoutTests/svg/filters/feSpotLight-color-expected.svg (226315 => 226316)


--- trunk/LayoutTests/svg/filters/feSpotLight-color-expected.svg	2018-01-01 19:53:39 UTC (rev 226315)
+++ trunk/LayoutTests/svg/filters/feSpotLight-color-expected.svg	2018-01-01 20:28:32 UTC (rev 226316)
@@ -5,6 +5,4 @@
     </filter>
 </defs>
 <rect x="0" y="00" width="400" height="400" filter="url(#filter)"/>
-<!-- Mask out a small difference in the bottom right corner -->
-<rect x="385" y="385" width="20" height="20" fill="black"/>
 </svg>

Modified: trunk/LayoutTests/svg/filters/feSpotLight-color.svg (226315 => 226316)


--- trunk/LayoutTests/svg/filters/feSpotLight-color.svg	2018-01-01 19:53:39 UTC (rev 226315)
+++ trunk/LayoutTests/svg/filters/feSpotLight-color.svg	2018-01-01 20:28:32 UTC (rev 226316)
@@ -7,6 +7,4 @@
     </filter>
 </defs>
 <rect x="0" y="0" width="400" height="400" filter="url(#filter)"/>
-<!-- Mask out a small difference in the bottom right corner -->
-<rect x="385" y="385" width="20" height="20" fill="black"/>
 </svg>

Added: trunk/LayoutTests/svg/filters/resources/feDiffuseLighting-rect.svg (0 => 226316)


--- trunk/LayoutTests/svg/filters/resources/feDiffuseLighting-rect.svg	                        (rev 0)
+++ trunk/LayoutTests/svg/filters/resources/feDiffuseLighting-rect.svg	2018-01-01 20:28:32 UTC (rev 226316)
@@ -0,0 +1,10 @@
+<svg width="10px" height="10px" xmlns="http://www.w3.org/2000/svg">
+<defs>
+    <filter id="filter" filterUnits="objectBoundingBox" x="0" y="0" width="100%" height="100%">
+        <feDiffuseLighting lighting-color="green">
+            <feDistantLight azimuth="100" elevation="100"/>
+        </feDiffuseLighting>
+    </filter>
+</defs>
+<rect id="target" x="0" y="0" width="10" height="10" filter="url(#filter)"/>
+</svg>

Modified: trunk/Source/WebCore/ChangeLog (226315 => 226316)


--- trunk/Source/WebCore/ChangeLog	2018-01-01 19:53:39 UTC (rev 226315)
+++ trunk/Source/WebCore/ChangeLog	2018-01-01 20:28:32 UTC (rev 226316)
@@ -1,3 +1,18 @@
+2017-12-31  Simon Fraser  <[email protected]>
+
+        Bottom right pixel of feDiffuseLighting has the wrong color
+        https://bugs.webkit.org/show_bug.cgi?id=181203
+
+        Reviewed by Antti Koivisto.
+
+        The lower right pixel of a feDiffuseLighting was the wrong color, because the kernel
+        values didn't match the spec for the bottom right Y values.
+
+        Test: svg/filters/feDiffuseLighting-bottomRightPixel.html
+
+        * platform/graphics/filters/FELighting.cpp:
+        (WebCore::FELighting::LightingData::bottomRightNormal const):
+
 2017-12-30  Simon Fraser  <[email protected]>
 
         SVG lighting colors need to be converted into linearSRGB

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


--- trunk/Source/WebCore/platform/graphics/filters/FELighting.cpp	2018-01-01 19:53:39 UTC (rev 226315)
+++ trunk/Source/WebCore/platform/graphics/filters/FELighting.cpp	2018-01-01 20:28:32 UTC (rev 226316)
@@ -233,7 +233,7 @@
     int top = static_cast<int>(pixels->item(offset + cAlphaChannelOffset));
     return {
         -topLeft + top - 2 * left + 2 * center,
-        topLeft - 2 * top + left + 2 * center
+        -topLeft - 2 * top + left + 2 * center
     };
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to