st/theme-node-drawing: Conditionally paint the center shadow rectangle
Only when part of it is actually visible. Because the central rectangle is generally the largest part, this eliminates most of the shadow's render time. For example, animating `.workspace-background` by tapping Super, the shell's overall render time is reduced about 15%. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1915>
This commit is contained in:
parent
436fd81cfc
commit
9b3ee774f6
@ -2021,6 +2021,8 @@ st_theme_node_paint_sliced_shadow (StThemeNodePaintState *state,
|
|||||||
gfloat shadow_blur_radius, x_spread_factor, y_spread_factor;
|
gfloat shadow_blur_radius, x_spread_factor, y_spread_factor;
|
||||||
float rectangles[8 * 9];
|
float rectangles[8 * 9];
|
||||||
gint idx;
|
gint idx;
|
||||||
|
ClutterColor background_color;
|
||||||
|
static const ClutterColor invisible_occluded = {3, 2, 1, 0};
|
||||||
|
|
||||||
if (paint_opacity == 0)
|
if (paint_opacity == 0)
|
||||||
return;
|
return;
|
||||||
@ -2178,16 +2180,23 @@ st_theme_node_paint_sliced_shadow (StThemeNodePaintState *state,
|
|||||||
rectangles[idx++] = s_bottom;
|
rectangles[idx++] = s_bottom;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Center middle */
|
/* Center middle is not definitely occluded? */
|
||||||
rectangles[idx++] = left;
|
st_theme_node_get_background_color (node, &background_color);
|
||||||
rectangles[idx++] = top;
|
if (!clutter_color_equal (&background_color, &invisible_occluded) ||
|
||||||
rectangles[idx++] = right;
|
paint_opacity < 255 ||
|
||||||
rectangles[idx++] = bottom;
|
xoffset > shadow_blur_radius || left < 0 ||
|
||||||
|
yoffset > shadow_blur_radius || top < 0)
|
||||||
|
{
|
||||||
|
rectangles[idx++] = left;
|
||||||
|
rectangles[idx++] = top;
|
||||||
|
rectangles[idx++] = right;
|
||||||
|
rectangles[idx++] = bottom;
|
||||||
|
|
||||||
rectangles[idx++] = s_left;
|
rectangles[idx++] = s_left;
|
||||||
rectangles[idx++] = s_top;
|
rectangles[idx++] = s_top;
|
||||||
rectangles[idx++] = s_right;
|
rectangles[idx++] = s_right;
|
||||||
rectangles[idx++] = s_bottom;
|
rectangles[idx++] = s_bottom;
|
||||||
|
}
|
||||||
|
|
||||||
if (xend > right)
|
if (xend > right)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user