Title: [272059] trunk
Revision
272059
Author
[email protected]
Date
2021-01-29 06:53:29 -0800 (Fri, 29 Jan 2021)

Log Message

REGRESSION(r262893): feComponentTransfer is not rendered correctly on Retina display
https://bugs.webkit.org/show_bug.cgi?id=220576

Reviewed by Simon Fraser.

Source/WebCore:

convertImageDataToColorSpace() creates a temporary ImageBuffer with the
size of m_premultipliedImageResult. This ImageBuffer has to be scaled
with the filterScale(). But the size of m_premultipliedImageResult is
scaled with the filterScale(). This means, convertImageDataToColorSpace()
applies the filterScale() twice to the temporary ImageBuffer.

The fix is to create the temporary ImageBuffer with the unscaled size of
the input ImageData and scale it with the filterScale().

Test: fast/hidpi/filters-component-transfer.html

* platform/graphics/filters/FilterEffect.cpp:
(WebCore::FilterEffect::convertImageDataToColorSpace):
(WebCore::FilterEffect::copyPremultipliedResult):

LayoutTests:

* fast/hidpi/filters-component-transfer-expected.html: Added.
* fast/hidpi/filters-component-transfer.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (272058 => 272059)


--- trunk/LayoutTests/ChangeLog	2021-01-29 13:03:11 UTC (rev 272058)
+++ trunk/LayoutTests/ChangeLog	2021-01-29 14:53:29 UTC (rev 272059)
@@ -1,3 +1,13 @@
+2021-01-29  Said Abou-Hallawa  <[email protected]>
+
+        REGRESSION(r262893): feComponentTransfer is not rendered correctly on Retina display
+        https://bugs.webkit.org/show_bug.cgi?id=220576
+
+        Reviewed by Simon Fraser.
+
+        * fast/hidpi/filters-component-transfer-expected.html: Added.
+        * fast/hidpi/filters-component-transfer.html: Added.
+
 2021-01-29  Philippe Normand  <[email protected]>
 
         [GStreamer][Playbin3] Support for CEA-608 closed captioned media

Added: trunk/LayoutTests/fast/hidpi/filters-component-transfer-expected.html (0 => 272059)


--- trunk/LayoutTests/fast/hidpi/filters-component-transfer-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/hidpi/filters-component-transfer-expected.html	2021-01-29 14:53:29 UTC (rev 272059)
@@ -0,0 +1,11 @@
+<script src=""
+<style>
+    #box {
+        width: 100px;
+        height: 100px;
+        background-color: green;
+    }
+</style>
+<body>
+    <div id="box"></div>
+</body>

Added: trunk/LayoutTests/fast/hidpi/filters-component-transfer.html (0 => 272059)


--- trunk/LayoutTests/fast/hidpi/filters-component-transfer.html	                        (rev 0)
+++ trunk/LayoutTests/fast/hidpi/filters-component-transfer.html	2021-01-29 14:53:29 UTC (rev 272059)
@@ -0,0 +1,18 @@
+<script src=""
+<style>
+    #box {
+        width: 100px;
+        height: 100px;
+        background-color: green;
+        filter: url("#a");
+    }
+</style>
+<body>
+    <div id="box"></div>
+    <svg>
+        <filter id="a">
+            <feComponentTransfer/>
+            <feGaussianBlur stdDeviation="0"/>
+        </filter>
+    </svg>
+</body>

Modified: trunk/Source/WebCore/ChangeLog (272058 => 272059)


--- trunk/Source/WebCore/ChangeLog	2021-01-29 13:03:11 UTC (rev 272058)
+++ trunk/Source/WebCore/ChangeLog	2021-01-29 14:53:29 UTC (rev 272059)
@@ -1,3 +1,25 @@
+2021-01-29  Said Abou-Hallawa  <[email protected]>
+
+        REGRESSION(r262893): feComponentTransfer is not rendered correctly on Retina display
+        https://bugs.webkit.org/show_bug.cgi?id=220576
+
+        Reviewed by Simon Fraser.
+
+        convertImageDataToColorSpace() creates a temporary ImageBuffer with the
+        size of m_premultipliedImageResult. This ImageBuffer has to be scaled
+        with the filterScale(). But the size of m_premultipliedImageResult is
+        scaled with the filterScale(). This means, convertImageDataToColorSpace()
+        applies the filterScale() twice to the temporary ImageBuffer.
+
+        The fix is to create the temporary ImageBuffer with the unscaled size of
+        the input ImageData and scale it with the filterScale().
+
+        Test: fast/hidpi/filters-component-transfer.html
+
+        * platform/graphics/filters/FilterEffect.cpp:
+        (WebCore::FilterEffect::convertImageDataToColorSpace):
+        (WebCore::FilterEffect::copyPremultipliedResult):
+
 2021-01-29  Philippe Normand  <[email protected]>
 
         [GTK] return-type-c-linkage warnings

Modified: trunk/Source/WebCore/platform/graphics/filters/FilterEffect.cpp (272058 => 272059)


--- trunk/Source/WebCore/platform/graphics/filters/FilterEffect.cpp	2021-01-29 13:03:11 UTC (rev 272058)
+++ trunk/Source/WebCore/platform/graphics/filters/FilterEffect.cpp	2021-01-29 14:53:29 UTC (rev 272059)
@@ -436,7 +436,8 @@
 RefPtr<ImageData> FilterEffect::convertImageDataToColorSpace(ColorSpace targetColorSpace, ImageData& inputData, AlphaPremultiplication outputFormat)
 {
     IntRect destinationRect(IntPoint(), inputData.size());
-    FloatSize clampedSize = ImageBuffer::clampedSize(inputData.size());
+    destinationRect.scale(1 / m_filter.filterScale());
+    FloatSize clampedSize = ImageBuffer::clampedSize(destinationRect.size());
     // Create an ImageBuffer to store incoming ImageData
     auto buffer = ImageBuffer::create(clampedSize, m_filter.renderingMode(), m_filter.filterScale(), operatingColorSpace());
     if (!buffer)
@@ -535,8 +536,7 @@
             copyPremultiplyingAlpha(*m_unmultipliedImageResult->data(), *m_premultipliedImageResult->data(), inputSize);
         }
     }
-    
-    RefPtr<ImageData> convertedImageData;
+
     if (requiresImageDataColorSpaceConversion(colorSpace)) {
         copyConvertedImageDataToDestination(destination, *m_premultipliedImageResult, *colorSpace, AlphaPremultiplication::Premultiplied, rect);
         return;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to