st-theme-node-drawing: Group multiple cogl_rectangle calls
Calling cogl_rectangles is more efficent then using multiple cogl_rectangle calls. https://bugzilla.gnome.org/show_bug.cgi?id=688475
This commit is contained in:
parent
0397a77713
commit
4fa914af31
@ -1553,7 +1553,7 @@ st_theme_node_paint_borders (StThemeNode *node,
|
|||||||
{
|
{
|
||||||
ClutterColor effective_border;
|
ClutterColor effective_border;
|
||||||
gboolean skip_corner_1, skip_corner_2;
|
gboolean skip_corner_1, skip_corner_2;
|
||||||
float x1, y1, x2, y2;
|
float rects[16];
|
||||||
|
|
||||||
over (&border_color, &node->background_color, &effective_border);
|
over (&border_color, &node->background_color, &effective_border);
|
||||||
alpha = paint_opacity * effective_border.alpha / 255;
|
alpha = paint_opacity * effective_border.alpha / 255;
|
||||||
@ -1569,46 +1569,44 @@ st_theme_node_paint_borders (StThemeNode *node,
|
|||||||
skip_corner_1 = border_radius[ST_CORNER_TOPLEFT] > 0;
|
skip_corner_1 = border_radius[ST_CORNER_TOPLEFT] > 0;
|
||||||
skip_corner_2 = border_radius[ST_CORNER_TOPRIGHT] > 0;
|
skip_corner_2 = border_radius[ST_CORNER_TOPRIGHT] > 0;
|
||||||
|
|
||||||
x1 = skip_corner_1 ? max_width_radius[ST_CORNER_TOPLEFT] : 0;
|
rects[0] = skip_corner_1 ? max_width_radius[ST_CORNER_TOPLEFT] : 0;
|
||||||
y1 = 0;
|
rects[1] = 0;
|
||||||
x2 = skip_corner_2 ? width - max_width_radius[ST_CORNER_TOPRIGHT] : width;
|
rects[2] = skip_corner_2 ? width - max_width_radius[ST_CORNER_TOPRIGHT] : width;
|
||||||
y2 = border_width[ST_SIDE_TOP];
|
rects[3] = border_width[ST_SIDE_TOP];
|
||||||
cogl_rectangle (x1, y1, x2, y2);
|
|
||||||
|
|
||||||
/* EAST */
|
/* EAST */
|
||||||
skip_corner_1 = border_radius[ST_CORNER_TOPRIGHT] > 0;
|
skip_corner_1 = border_radius[ST_CORNER_TOPRIGHT] > 0;
|
||||||
skip_corner_2 = border_radius[ST_CORNER_BOTTOMRIGHT] > 0;
|
skip_corner_2 = border_radius[ST_CORNER_BOTTOMRIGHT] > 0;
|
||||||
|
|
||||||
x1 = width - border_width[ST_SIDE_RIGHT];
|
rects[4] = width - border_width[ST_SIDE_RIGHT];
|
||||||
y1 = skip_corner_1 ? max_width_radius[ST_CORNER_TOPRIGHT]
|
rects[5] = skip_corner_1 ? max_width_radius[ST_CORNER_TOPRIGHT]
|
||||||
: border_width[ST_SIDE_TOP];
|
: border_width[ST_SIDE_TOP];
|
||||||
x2 = width;
|
rects[6] = width;
|
||||||
y2 = skip_corner_2 ? height - max_width_radius[ST_CORNER_BOTTOMRIGHT]
|
rects[7] = skip_corner_2 ? height - max_width_radius[ST_CORNER_BOTTOMRIGHT]
|
||||||
: height - border_width[ST_SIDE_BOTTOM];
|
: height - border_width[ST_SIDE_BOTTOM];
|
||||||
cogl_rectangle (x1, y1, x2, y2);
|
|
||||||
|
|
||||||
/* SOUTH */
|
/* SOUTH */
|
||||||
skip_corner_1 = border_radius[ST_CORNER_BOTTOMLEFT] > 0;
|
skip_corner_1 = border_radius[ST_CORNER_BOTTOMLEFT] > 0;
|
||||||
skip_corner_2 = border_radius[ST_CORNER_BOTTOMRIGHT] > 0;
|
skip_corner_2 = border_radius[ST_CORNER_BOTTOMRIGHT] > 0;
|
||||||
|
|
||||||
x1 = skip_corner_1 ? max_width_radius[ST_CORNER_BOTTOMLEFT] : 0;
|
rects[8] = skip_corner_1 ? max_width_radius[ST_CORNER_BOTTOMLEFT] : 0;
|
||||||
y1 = height - border_width[ST_SIDE_BOTTOM];
|
rects[9] = height - border_width[ST_SIDE_BOTTOM];
|
||||||
x2 = skip_corner_2 ? width - max_width_radius[ST_CORNER_BOTTOMRIGHT]
|
rects[10] = skip_corner_2 ? width - max_width_radius[ST_CORNER_BOTTOMRIGHT]
|
||||||
: width;
|
: width;
|
||||||
y2 = height;
|
rects[11] = height;
|
||||||
cogl_rectangle (x1, y1, x2, y2);
|
|
||||||
|
|
||||||
/* WEST */
|
/* WEST */
|
||||||
skip_corner_1 = border_radius[ST_CORNER_TOPLEFT] > 0;
|
skip_corner_1 = border_radius[ST_CORNER_TOPLEFT] > 0;
|
||||||
skip_corner_2 = border_radius[ST_CORNER_BOTTOMLEFT] > 0;
|
skip_corner_2 = border_radius[ST_CORNER_BOTTOMLEFT] > 0;
|
||||||
|
|
||||||
x1 = 0;
|
rects[12] = 0;
|
||||||
y1 = skip_corner_1 ? max_width_radius[ST_CORNER_TOPLEFT]
|
rects[13] = skip_corner_1 ? max_width_radius[ST_CORNER_TOPLEFT]
|
||||||
: border_width[ST_SIDE_TOP];
|
: border_width[ST_SIDE_TOP];
|
||||||
x2 = border_width[ST_SIDE_LEFT];
|
rects[14] = border_width[ST_SIDE_LEFT];
|
||||||
y2 = skip_corner_2 ? height - max_width_radius[ST_CORNER_BOTTOMLEFT]
|
rects[15] = skip_corner_2 ? height - max_width_radius[ST_CORNER_BOTTOMLEFT]
|
||||||
: height - border_width[ST_SIDE_BOTTOM];
|
: height - border_width[ST_SIDE_BOTTOM];
|
||||||
cogl_rectangle (x1, y1, x2, y2);
|
|
||||||
|
cogl_rectangles (rects, 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1875,6 +1873,7 @@ st_theme_node_paint_outline (StThemeNode *node,
|
|||||||
{
|
{
|
||||||
float width, height;
|
float width, height;
|
||||||
int outline_width;
|
int outline_width;
|
||||||
|
float rects[16];
|
||||||
ClutterColor outline_color, effective_outline;
|
ClutterColor outline_color, effective_outline;
|
||||||
|
|
||||||
width = box->x2 - box->x1;
|
width = box->x2 - box->x1;
|
||||||
@ -1899,20 +1898,30 @@ st_theme_node_paint_outline (StThemeNode *node,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* NORTH */
|
/* NORTH */
|
||||||
cogl_rectangle (-outline_width, -outline_width,
|
rects[0] = -outline_width;
|
||||||
width + outline_width, 0);
|
rects[1] = -outline_width;
|
||||||
|
rects[2] = width + outline_width;
|
||||||
|
rects[3] = 0;
|
||||||
|
|
||||||
/* EAST */
|
/* EAST */
|
||||||
cogl_rectangle (width, 0,
|
rects[4] = width;
|
||||||
width + outline_width, height);
|
rects[5] = 0;
|
||||||
|
rects[6] = width + outline_width;
|
||||||
|
rects[7] = height;
|
||||||
|
|
||||||
/* SOUTH */
|
/* SOUTH */
|
||||||
cogl_rectangle (-outline_width, height,
|
rects[8] = -outline_width;
|
||||||
width + outline_width, height + outline_width);
|
rects[9] = height;
|
||||||
|
rects[10] = width + outline_width;
|
||||||
|
rects[11] = height + outline_width;
|
||||||
|
|
||||||
/* WEST */
|
/* WEST */
|
||||||
cogl_rectangle (-outline_width, 0,
|
rects[12] = -outline_width;
|
||||||
0, height);
|
rects[13] = 0;
|
||||||
|
rects[14] = 0;
|
||||||
|
rects[15] = height;
|
||||||
|
|
||||||
|
cogl_rectangles (rects, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user