Title: [236412] trunk
Revision
236412
Author
simon.fra...@apple.com
Date
2018-09-24 11:00:31 -0700 (Mon, 24 Sep 2018)

Log Message

Garbled rendering of image when applied feConvolveMatrix to it, on Retina display
https://bugs.webkit.org/show_bug.cgi?id=189748
<rdar://problem/44621494>

Reviewed by Jon Lee.
Source/WebCore:

feConvolveMatrix needs to scale the paintSize by the filter scale (2x on Retina displays),
otherwise parts of the output buffer are uninitialized and the result is incorrect.

Test: css3/filters/hidpi-feConvolveMatrix.html

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

LayoutTests:

* css3/filters/hidpi-feConvolveMatrix-expected.html: Added.
* css3/filters/hidpi-feConvolveMatrix.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (236411 => 236412)


--- trunk/LayoutTests/ChangeLog	2018-09-24 17:37:47 UTC (rev 236411)
+++ trunk/LayoutTests/ChangeLog	2018-09-24 18:00:31 UTC (rev 236412)
@@ -1,3 +1,14 @@
+2018-09-24  Simon Fraser  <simon.fra...@apple.com>
+
+        Garbled rendering of image when applied feConvolveMatrix to it, on Retina display
+        https://bugs.webkit.org/show_bug.cgi?id=189748
+        <rdar://problem/44621494>
+
+        Reviewed by Jon Lee.
+
+        * css3/filters/hidpi-feConvolveMatrix-expected.html: Added.
+        * css3/filters/hidpi-feConvolveMatrix.html: Added.
+
 2018-09-22  Dean Jackson  <d...@apple.com>
 
         Ensure PointerEvent is not visible when disabled

Added: trunk/LayoutTests/css3/filters/hidpi-feConvolveMatrix-expected.html (0 => 236412)


--- trunk/LayoutTests/css3/filters/hidpi-feConvolveMatrix-expected.html	                        (rev 0)
+++ trunk/LayoutTests/css3/filters/hidpi-feConvolveMatrix-expected.html	2018-09-24 18:00:31 UTC (rev 236412)
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <style>
+        .box {
+            width: 200px;
+            height: 200px;
+            background-color: green;
+        }
+    </style>
+</head>
+<body>
+    <div class="box"></div>
+</body>
+</html>

Added: trunk/LayoutTests/css3/filters/hidpi-feConvolveMatrix.html (0 => 236412)


--- trunk/LayoutTests/css3/filters/hidpi-feConvolveMatrix.html	                        (rev 0)
+++ trunk/LayoutTests/css3/filters/hidpi-feConvolveMatrix.html	2018-09-24 18:00:31 UTC (rev 236412)
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <style>
+        .box {
+            width: 200px;
+            height: 200px;
+            background-color: green;
+            filter: url(#sharpen);
+        }
+    </style>
+</head>
+<body>
+	<svg style="display:none;" xmlns="http://www.w3.org/2000/svg" version="1.1">
+		<defs>
+			<filter id="sharpen">
+    			<feConvolveMatrix order="3 3" preserveAlpha="true" kernelMatrix="0 0 0 0 1 0 0 0 0" />
+  			</filter>
+		</defs>
+	</svg>
+    <div class="box"></div>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (236411 => 236412)


--- trunk/Source/WebCore/ChangeLog	2018-09-24 17:37:47 UTC (rev 236411)
+++ trunk/Source/WebCore/ChangeLog	2018-09-24 18:00:31 UTC (rev 236412)
@@ -1,3 +1,19 @@
+2018-09-24  Simon Fraser  <simon.fra...@apple.com>
+
+        Garbled rendering of image when applied feConvolveMatrix to it, on Retina display
+        https://bugs.webkit.org/show_bug.cgi?id=189748
+        <rdar://problem/44621494>
+
+        Reviewed by Jon Lee.
+        
+        feConvolveMatrix needs to scale the paintSize by the filter scale (2x on Retina displays),
+        otherwise parts of the output buffer are uninitialized and the result is incorrect.
+
+        Test: css3/filters/hidpi-feConvolveMatrix.html
+
+        * platform/graphics/filters/FEConvolveMatrix.cpp:
+        (WebCore::FEConvolveMatrix::platformApplySoftware):
+
 2018-09-22  Dean Jackson  <d...@apple.com>
 
         Ensure PointerEvent is not visible when disabled

Modified: trunk/Source/WebCore/platform/graphics/filters/FEConvolveMatrix.cpp (236411 => 236412)


--- trunk/Source/WebCore/platform/graphics/filters/FEConvolveMatrix.cpp	2018-09-24 17:37:47 UTC (rev 236411)
+++ trunk/Source/WebCore/platform/graphics/filters/FEConvolveMatrix.cpp	2018-09-24 18:00:31 UTC (rev 236412)
@@ -391,6 +391,8 @@
         return;
 
     IntSize paintSize = absolutePaintRect().size();
+    paintSize.scale(filter().filterScale());
+
     PaintingData paintingData = {
         *srcPixelArray,
         *resultImage,
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to