[gnome-shell/gnome-3-38] st-theme-node-drawing: Render all shadow sections with thickness > 0



commit 04028e87bf2793ea4f0862279f076807271dd897
Author: Daniel van Vugt <daniel van vugt canonical com>
Date:   Wed Aug 19 19:22:51 2020 +0800

    st-theme-node-drawing: Render all shadow sections with thickness > 0
    
    In some styles the top or left sections of box-shadows would go missing
    even though they had non-zero thickness. This was because the inner
    local coordinates could become very slightly negative and were then
    incorrectly judged to be invisible.
    
    Negative coordinates should not be ignored because that's where the
    entire top/left sections of shadow are meant to exist. It's only the
    sections of shadow with zero thickness that we should skip.
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1417>
    
    (cherry picked from commit 5492309755b49203a13b23e2185387a009cf1aa7)

 src/st/st-theme-node-drawing.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)
---
diff --git a/src/st/st-theme-node-drawing.c b/src/st/st-theme-node-drawing.c
index c5df5fc62d..db43171446 100644
--- a/src/st/st-theme-node-drawing.c
+++ b/src/st/st-theme-node-drawing.c
@@ -2103,9 +2103,9 @@ st_theme_node_paint_sliced_shadow (StThemeNodePaintState *state,
 
   idx = 0;
 
-  if (top > 0)
+  if (yoffset < top)
     {
-      if (left > 0)
+      if (xoffset < left)
         {
           /* Top left corner */
           rectangles[idx++] = xoffset;
@@ -2130,7 +2130,7 @@ st_theme_node_paint_sliced_shadow (StThemeNodePaintState *state,
       rectangles[idx++] = s_right;
       rectangles[idx++] = s_top;
 
-      if (right > 0)
+      if (xend > right)
         {
           /* Top right corner */
           rectangles[idx++] = right;
@@ -2145,7 +2145,7 @@ st_theme_node_paint_sliced_shadow (StThemeNodePaintState *state,
         }
     }
 
-  if (left > 0)
+  if (xoffset < left)
     {
       /* Left middle */
       rectangles[idx++] = xoffset;
@@ -2170,8 +2170,7 @@ st_theme_node_paint_sliced_shadow (StThemeNodePaintState *state,
   rectangles[idx++] = s_right;
   rectangles[idx++] = s_bottom;
 
-
-  if (right > 0)
+  if (xend > right)
     {
       /* Right middle */
       rectangles[idx++] = right;
@@ -2185,9 +2184,9 @@ st_theme_node_paint_sliced_shadow (StThemeNodePaintState *state,
       rectangles[idx++] = s_bottom;
     }
 
-  if (bottom > 0)
+  if (yend > bottom)
     {
-      if (left > 0)
+      if (xoffset < left)
         {
           /* Bottom left corner */
           rectangles[idx++] = xoffset;
@@ -2212,7 +2211,7 @@ st_theme_node_paint_sliced_shadow (StThemeNodePaintState *state,
       rectangles[idx++] = s_right;
       rectangles[idx++] = 1;
 
-      if (right > 0)
+      if (xend > right)
         {
           /* Bottom right corner */
           rectangles[idx++] = right;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]