[GPU Process] GraphicsContextStateChange must accumulate fill and stroke fields as...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 12 Mar 2020 08:10:15 +0000 (08:10 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 12 Mar 2020 08:10:15 +0000 (08:10 +0000)
https://bugs.webkit.org/show_bug.cgi?id=208971

Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2020-03-12
Reviewed by Simon Fraser.

Source/WebCore:

Setting the fill or the stroke should set one field: color, gradient or
pattern. When detecting a change any of them, accumulate() should copy
all of the fields from the source state to the destination state.

* platform/graphics/GraphicsContext.cpp:
(WebCore::GraphicsContextStateChange::accumulate):
* platform/graphics/GraphicsContext.h:

LayoutTests:

Adjust the change-flags values in the displaylists tests since the first
bit was not used.

* displaylists/canvas-display-list-expected.txt:
* displaylists/extent-includes-shadow-expected.txt:
* displaylists/extent-includes-transforms-expected.txt:
* displaylists/layer-dispay-list-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@258317 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/displaylists/canvas-display-list-expected.txt
LayoutTests/displaylists/extent-includes-shadow-expected.txt
LayoutTests/displaylists/extent-includes-transforms-expected.txt
LayoutTests/displaylists/layer-dispay-list-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/GraphicsContext.cpp
Source/WebCore/platform/graphics/GraphicsContext.h

index 402a196..f4daf32 100644 (file)
@@ -1,3 +1,18 @@
+2020-03-12  Said Abou-Hallawa  <sabouhallawa@apple.com>
+
+        [GPU Process] GraphicsContextStateChange must accumulate fill and stroke fields as single properties
+        https://bugs.webkit.org/show_bug.cgi?id=208971
+
+        Reviewed by Simon Fraser.
+
+        Adjust the change-flags values in the displaylists tests since the first
+        bit was not used.
+
+        * displaylists/canvas-display-list-expected.txt:
+        * displaylists/extent-includes-shadow-expected.txt:
+        * displaylists/extent-includes-transforms-expected.txt:
+        * displaylists/layer-dispay-list-expected.txt:
+
 2020-03-12  Diego Pino Garcia  <dpino@igalia.com>
 
         [GTK] Gardening, update TestExpectations
index f56ca6d..aeaee11 100644 (file)
@@ -1,7 +1,7 @@
  
 (save)
 (set-state
-  (change-flags 1050912)
+  (change-flags 525456)
   (stroke-thickness 1.00)
   (fill-color #C80000)
   (shadows-ignore-transforms 1))
@@ -9,7 +9,7 @@
   (extent at (10,10) size 55x50)
   (rect at (10,10) size 55x50))
 (set-state
-  (change-flags 256)
+  (change-flags 128)
   (fill-color #0000C880))
 (fill-rect
   (extent at (30,30) size 55x50)
index 7770bf4..e9f5404 100644 (file)
@@ -4,7 +4,7 @@
   (y 0.00))
 (save)
 (set-state
-  (change-flags 1024)
+  (change-flags 512)
   (shadow-blur 12.00)
   (shadow-offset width=10 height=20)
   (shadows-use-legacy-radius 0))
index 3e446fb..e0452a1 100644 (file)
@@ -6,7 +6,7 @@
   (ctm {m=((0.87,0.50)(-0.50,0.87)) t=(81.70,-18.30)}))
 (save)
 (set-state
-  (change-flags 1024)
+  (change-flags 512)
   (shadow-blur 12.00)
   (shadow-offset width=10 height=20)
   (shadows-use-legacy-radius 0))
index bf3d852..bd876df 100644 (file)
@@ -9,7 +9,7 @@
   (composite-operation source-over)
   (blend-mode normal))
 (set-state
-  (change-flags 65920)
+  (change-flags 32960)
   (fill-color #0000FF)
   (stroke-style 0)
   (should-antialias 0))
index df7294a..0c91bf2 100644 (file)
@@ -1,3 +1,18 @@
+2020-03-12  Said Abou-Hallawa  <sabouhallawa@apple.com>
+
+        [GPU Process] GraphicsContextStateChange must accumulate fill and stroke fields as single properties
+        https://bugs.webkit.org/show_bug.cgi?id=208971
+
+        Reviewed by Simon Fraser.
+
+        Setting the fill or the stroke should set one field: color, gradient or
+        pattern. When detecting a change any of them, accumulate() should copy
+        all of the fields from the source state to the destination state.
+
+        * platform/graphics/GraphicsContext.cpp:
+        (WebCore::GraphicsContextStateChange::accumulate):
+        * platform/graphics/GraphicsContext.h:
+
 2020-03-11  Antoine Quint  <graouts@webkit.org>
 
         AnimationTimeline should not have multiple HashMaps with raw Element* keys
index c2e3c01..5425b42 100644 (file)
@@ -121,17 +121,17 @@ GraphicsContextState::StateChangeFlags GraphicsContextStateChange::changesFromSt
 void GraphicsContextStateChange::accumulate(const GraphicsContextState& state, GraphicsContextState::StateChangeFlags flags)
 {
     // FIXME: This code should move to GraphicsContextState.
-    if (flags.contains(GraphicsContextState::StrokeGradientChange))
+    if (flags.containsAny({ GraphicsContextState::StrokeColorChange, GraphicsContextState::StrokeGradientChange, GraphicsContextState::StrokePatternChange })) {
+        m_state.strokeColor = state.strokeColor;
         m_state.strokeGradient = state.strokeGradient;
-
-    if (flags.contains(GraphicsContextState::StrokePatternChange))
         m_state.strokePattern = state.strokePattern;
+    }
 
-    if (flags.contains(GraphicsContextState::FillGradientChange))
+    if (flags.containsAny({ GraphicsContextState::FillColorChange, GraphicsContextState::FillGradientChange, GraphicsContextState::FillPatternChange })) {
+        m_state.fillColor = state.fillColor;
         m_state.fillGradient = state.fillGradient;
-
-    if (flags.contains(GraphicsContextState::FillPatternChange))
         m_state.fillPattern = state.fillPattern;
+    }
 
     if (flags.contains(GraphicsContextState::ShadowChange)) {
         // FIXME: Deal with state.shadowsUseLegacyRadius.
@@ -146,12 +146,6 @@ void GraphicsContextStateChange::accumulate(const GraphicsContextState& state, G
     if (flags.contains(GraphicsContextState::TextDrawingModeChange))
         m_state.textDrawingMode = state.textDrawingMode;
 
-    if (flags.contains(GraphicsContextState::StrokeColorChange))
-        m_state.strokeColor = state.strokeColor;
-
-    if (flags.contains(GraphicsContextState::FillColorChange))
-        m_state.fillColor = state.fillColor;
-
     if (flags.contains(GraphicsContextState::StrokeStyleChange))
         m_state.strokeStyle = state.strokeStyle;
 
index 2a2ec01..c138403 100644 (file)
@@ -173,28 +173,28 @@ struct GraphicsContextState {
     }
 
     enum Change : uint32_t {
-        StrokeGradientChange                    = 1 << 1,
-        StrokePatternChange                     = 1 << 2,
-        FillGradientChange                      = 1 << 3,
-        FillPatternChange                       = 1 << 4,
-        StrokeThicknessChange                   = 1 << 5,
-        StrokeColorChange                       = 1 << 6,
-        StrokeStyleChange                       = 1 << 7,
-        FillColorChange                         = 1 << 8,
-        FillRuleChange                          = 1 << 9,
-        ShadowChange                            = 1 << 10,
-        ShadowsIgnoreTransformsChange           = 1 << 11,
-        AlphaChange                             = 1 << 12,
-        CompositeOperationChange                = 1 << 13,
-        BlendModeChange                         = 1 << 14,
-        TextDrawingModeChange                   = 1 << 15,
-        ShouldAntialiasChange                   = 1 << 16,
-        ShouldSmoothFontsChange                 = 1 << 17,
-        ShouldSubpixelQuantizeFontsChange       = 1 << 18,
-        DrawLuminanceMaskChange                 = 1 << 19,
-        ImageInterpolationQualityChange         = 1 << 20,
+        StrokeGradientChange                    = 1 << 0,
+        StrokePatternChange                     = 1 << 1,
+        FillGradientChange                      = 1 << 2,
+        FillPatternChange                       = 1 << 3,
+        StrokeThicknessChange                   = 1 << 4,
+        StrokeColorChange                       = 1 << 5,
+        StrokeStyleChange                       = 1 << 6,
+        FillColorChange                         = 1 << 7,
+        FillRuleChange                          = 1 << 8,
+        ShadowChange                            = 1 << 9,
+        ShadowsIgnoreTransformsChange           = 1 << 10,
+        AlphaChange                             = 1 << 11,
+        CompositeOperationChange                = 1 << 12,
+        BlendModeChange                         = 1 << 13,
+        TextDrawingModeChange                   = 1 << 14,
+        ShouldAntialiasChange                   = 1 << 15,
+        ShouldSmoothFontsChange                 = 1 << 16,
+        ShouldSubpixelQuantizeFontsChange       = 1 << 17,
+        DrawLuminanceMaskChange                 = 1 << 18,
+        ImageInterpolationQualityChange         = 1 << 19,
 #if HAVE(OS_DARK_MODE_SUPPORT)
-        UseDarkAppearanceChange                 = 1 << 21,
+        UseDarkAppearanceChange                 = 1 << 20,
 #endif
     };
     typedef OptionSet<Change> StateChangeFlags;