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>
This commit is contained in:
Daniel van Vugt 2020-08-19 19:22:51 +08:00 committed by Florian Müllner
parent 595359afa5
commit 5492309755

View File

@ -2103,9 +2103,9 @@ st_theme_node_paint_sliced_shadow (StThemeNodePaintState *state,
idx = 0; idx = 0;
if (top > 0) if (yoffset < top)
{ {
if (left > 0) if (xoffset < left)
{ {
/* Top left corner */ /* Top left corner */
rectangles[idx++] = xoffset; rectangles[idx++] = xoffset;
@ -2130,7 +2130,7 @@ st_theme_node_paint_sliced_shadow (StThemeNodePaintState *state,
rectangles[idx++] = s_right; rectangles[idx++] = s_right;
rectangles[idx++] = s_top; rectangles[idx++] = s_top;
if (right > 0) if (xend > right)
{ {
/* Top right corner */ /* Top right corner */
rectangles[idx++] = right; rectangles[idx++] = right;
@ -2145,7 +2145,7 @@ st_theme_node_paint_sliced_shadow (StThemeNodePaintState *state,
} }
} }
if (left > 0) if (xoffset < left)
{ {
/* Left middle */ /* Left middle */
rectangles[idx++] = xoffset; rectangles[idx++] = xoffset;
@ -2170,8 +2170,7 @@ st_theme_node_paint_sliced_shadow (StThemeNodePaintState *state,
rectangles[idx++] = s_right; rectangles[idx++] = s_right;
rectangles[idx++] = s_bottom; rectangles[idx++] = s_bottom;
if (xend > right)
if (right > 0)
{ {
/* Right middle */ /* Right middle */
rectangles[idx++] = right; rectangles[idx++] = right;
@ -2185,9 +2184,9 @@ st_theme_node_paint_sliced_shadow (StThemeNodePaintState *state,
rectangles[idx++] = s_bottom; rectangles[idx++] = s_bottom;
} }
if (bottom > 0) if (yend > bottom)
{ {
if (left > 0) if (xoffset < left)
{ {
/* Bottom left corner */ /* Bottom left corner */
rectangles[idx++] = xoffset; rectangles[idx++] = xoffset;
@ -2212,7 +2211,7 @@ st_theme_node_paint_sliced_shadow (StThemeNodePaintState *state,
rectangles[idx++] = s_right; rectangles[idx++] = s_right;
rectangles[idx++] = 1; rectangles[idx++] = 1;
if (right > 0) if (xend > right)
{ {
/* Bottom right corner */ /* Bottom right corner */
rectangles[idx++] = right; rectangles[idx++] = right;