Title: [270040] trunk
Revision
270040
Author
[email protected]
Date
2020-11-19 11:43:15 -0800 (Thu, 19 Nov 2020)

Log Message

[TextureMapperGL] The invert filter wrongly inverts pre-multiplied alpha color
https://bugs.webkit.org/show_bug.cgi?id=219144

Reviewed by Carlos Garcia Campos.

Source/WebCore:

Test: compositing/filters/invert-transparent.html

* platform/graphics/texmap/TextureMapperShaderProgram.cpp: Take alpha value as an argument.

LayoutTests:

* compositing/filters/invert-transparent-expected.html: Added.
* compositing/filters/invert-transparent.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (270039 => 270040)


--- trunk/LayoutTests/ChangeLog	2020-11-19 19:40:45 UTC (rev 270039)
+++ trunk/LayoutTests/ChangeLog	2020-11-19 19:43:15 UTC (rev 270040)
@@ -1,3 +1,13 @@
+2020-11-19  Fujii Hironori  <[email protected]>
+
+        [TextureMapperGL] The invert filter wrongly inverts pre-multiplied alpha color
+        https://bugs.webkit.org/show_bug.cgi?id=219144
+
+        Reviewed by Carlos Garcia Campos.
+
+        * compositing/filters/invert-transparent-expected.html: Added.
+        * compositing/filters/invert-transparent.html: Added.
+
 2020-11-19  Chris Dumez  <[email protected]>
 
         Import web-platform-tests/uievents tests from upstream

Added: trunk/LayoutTests/compositing/filters/invert-transparent-expected.html (0 => 270040)


--- trunk/LayoutTests/compositing/filters/invert-transparent-expected.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/filters/invert-transparent-expected.html	2020-11-19 19:43:15 UTC (rev 270040)
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <style>
+            html {
+                background: black;
+                color: white;
+            }
+            div {
+                position: absolute;
+                width: 200px;
+                height: 200px;
+                filter: invert();
+            }
+            .y {
+                transform:  translate(300px, 30px) rotate(20deg);
+            }
+        </style>
+    </head>
+    <body>
+        You should see no white boxes bellow.
+        <div class="x">
+        </div>
+        <div class="y">
+        </div>
+    </body>
+</html>

Added: trunk/LayoutTests/compositing/filters/invert-transparent.html (0 => 270040)


--- trunk/LayoutTests/compositing/filters/invert-transparent.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/filters/invert-transparent.html	2020-11-19 19:43:15 UTC (rev 270040)
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <style>
+            html {
+                background: black;
+                color: white;
+            }
+            div {
+                position: absolute;
+                width: 200px;
+                height: 200px;
+                filter: invert();
+                will-change: transform;
+            }
+            .y {
+                transform:  translate(300px, 30px) rotate(20deg);
+            }
+        </style>
+    </head>
+    <body>
+        You should see no white boxes bellow.
+        <div class="x">
+        </div>
+        <div class="y">
+        </div>
+    </body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (270039 => 270040)


--- trunk/Source/WebCore/ChangeLog	2020-11-19 19:40:45 UTC (rev 270039)
+++ trunk/Source/WebCore/ChangeLog	2020-11-19 19:43:15 UTC (rev 270040)
@@ -1,3 +1,14 @@
+2020-11-19  Fujii Hironori  <[email protected]>
+
+        [TextureMapperGL] The invert filter wrongly inverts pre-multiplied alpha color
+        https://bugs.webkit.org/show_bug.cgi?id=219144
+
+        Reviewed by Carlos Garcia Campos.
+
+        Test: compositing/filters/invert-transparent.html
+
+        * platform/graphics/texmap/TextureMapperShaderProgram.cpp: Take alpha value as an argument.
+
 2020-11-19  Lauro Moura  <[email protected]>
 
         [GStreamer] Fix OptionSet initialization after r270019

Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperShaderProgram.cpp (270039 => 270040)


--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperShaderProgram.cpp	2020-11-19 19:40:45 UTC (rev 270039)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperShaderProgram.cpp	2020-11-19 19:43:15 UTC (rev 270040)
@@ -337,10 +337,10 @@
                 color.a);
         }
 
-        float invert(float n) { return (1.0 - n) * u_filterAmount + n * (1.0 - u_filterAmount); }
+        float invert(float n, float a) { return (a - n) * u_filterAmount + n * (1.0 - u_filterAmount); }
         void applyInvertFilter(inout vec4 color)
         {
-            color = vec4(invert(color.r), invert(color.g), invert(color.b), color.a);
+            color = vec4(invert(color.r, color.a), invert(color.g, color.a), invert(color.b, color.a), color.a);
         }
 
         void applyBrightnessFilter(inout vec4 color)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to