themingengine: don't use gtk_theming_engine_get()
This also avoids some useless GdkRGBA heap allocations when drawing a border.
This commit is contained in:
parent
e6660bcfe1
commit
f2da5f30c1
@ -1050,10 +1050,8 @@ gtk_theming_engine_render_check (GtkThemingEngine *engine,
|
|||||||
gtk_theming_engine_get_color (engine, flags, &fg_color);
|
gtk_theming_engine_get_color (engine, flags, &fg_color);
|
||||||
gtk_theming_engine_get_background_color (engine, flags, &bg_color);
|
gtk_theming_engine_get_background_color (engine, flags, &bg_color);
|
||||||
gtk_theming_engine_get_border (engine, flags, &border);
|
gtk_theming_engine_get_border (engine, flags, &border);
|
||||||
|
border_style = _gtk_css_border_style_value_get
|
||||||
gtk_theming_engine_get (engine, flags,
|
(_gtk_theming_engine_peek_property (engine, GTK_CSS_PROPERTY_BORDER_TOP_STYLE));
|
||||||
"border-style", &border_style,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
border_width = MIN (MIN (border.top, border.bottom),
|
border_width = MIN (MIN (border.top, border.bottom),
|
||||||
MIN (border.left, border.right));
|
MIN (border.left, border.right));
|
||||||
@ -1175,10 +1173,8 @@ gtk_theming_engine_render_option (GtkThemingEngine *engine,
|
|||||||
gtk_theming_engine_get_color (engine, flags, &fg_color);
|
gtk_theming_engine_get_color (engine, flags, &fg_color);
|
||||||
gtk_theming_engine_get_background_color (engine, flags, &bg_color);
|
gtk_theming_engine_get_background_color (engine, flags, &bg_color);
|
||||||
gtk_theming_engine_get_border (engine, flags, &border);
|
gtk_theming_engine_get_border (engine, flags, &border);
|
||||||
|
border_style = _gtk_css_border_style_value_get
|
||||||
gtk_theming_engine_get (engine, flags,
|
(_gtk_theming_engine_peek_property (engine, GTK_CSS_PROPERTY_BORDER_TOP_STYLE));
|
||||||
"border-style", &border_style,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
exterior_size = MIN (width, height);
|
exterior_size = MIN (width, height);
|
||||||
border_width = MIN (MIN (border.top, border.bottom),
|
border_width = MIN (MIN (border.top, border.bottom),
|
||||||
@ -1741,9 +1737,7 @@ render_frame_internal (GtkThemingEngine *engine,
|
|||||||
GtkBorderStyle border_style[4];
|
GtkBorderStyle border_style[4];
|
||||||
GtkRoundedBox border_box;
|
GtkRoundedBox border_box;
|
||||||
GtkBorder border;
|
GtkBorder border;
|
||||||
GdkRGBA *alloc_colors[4];
|
|
||||||
GdkRGBA colors[4];
|
GdkRGBA colors[4];
|
||||||
guint i;
|
|
||||||
|
|
||||||
state = gtk_theming_engine_get_state (engine);
|
state = gtk_theming_engine_get_state (engine);
|
||||||
|
|
||||||
@ -1754,22 +1748,15 @@ render_frame_internal (GtkThemingEngine *engine,
|
|||||||
_gtk_border_image_render (&border_image, &border, cr, x, y, width, height);
|
_gtk_border_image_render (&border_image, &border, cr, x, y, width, height);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gtk_theming_engine_get (engine, state,
|
border_style[0] = _gtk_css_border_style_value_get (_gtk_theming_engine_peek_property (engine, GTK_CSS_PROPERTY_BORDER_TOP_STYLE));
|
||||||
"border-top-style", &border_style[0],
|
border_style[1] = _gtk_css_border_style_value_get (_gtk_theming_engine_peek_property (engine, GTK_CSS_PROPERTY_BORDER_RIGHT_STYLE));
|
||||||
"border-right-style", &border_style[1],
|
border_style[2] = _gtk_css_border_style_value_get (_gtk_theming_engine_peek_property (engine, GTK_CSS_PROPERTY_BORDER_BOTTOM_STYLE));
|
||||||
"border-bottom-style", &border_style[2],
|
border_style[3] = _gtk_css_border_style_value_get (_gtk_theming_engine_peek_property (engine, GTK_CSS_PROPERTY_BORDER_LEFT_STYLE));
|
||||||
"border-left-style", &border_style[3],
|
|
||||||
"border-top-color", &alloc_colors[0],
|
|
||||||
"border-right-color", &alloc_colors[1],
|
|
||||||
"border-bottom-color", &alloc_colors[2],
|
|
||||||
"border-left-color", &alloc_colors[3],
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
for (i = 0; i < 4; i++)
|
colors[0] = *_gtk_css_rgba_value_get_rgba (_gtk_theming_engine_peek_property (engine, GTK_CSS_PROPERTY_BORDER_TOP_COLOR));
|
||||||
{
|
colors[1] = *_gtk_css_rgba_value_get_rgba (_gtk_theming_engine_peek_property (engine, GTK_CSS_PROPERTY_BORDER_RIGHT_COLOR));
|
||||||
colors[i] = *alloc_colors[i];
|
colors[2] = *_gtk_css_rgba_value_get_rgba (_gtk_theming_engine_peek_property (engine, GTK_CSS_PROPERTY_BORDER_BOTTOM_COLOR));
|
||||||
gdk_rgba_free (alloc_colors[i]);
|
colors[3] = *_gtk_css_rgba_value_get_rgba (_gtk_theming_engine_peek_property (engine, GTK_CSS_PROPERTY_BORDER_LEFT_COLOR));
|
||||||
}
|
|
||||||
|
|
||||||
_gtk_rounded_box_init_rect (&border_box, x, y, width, height);
|
_gtk_rounded_box_init_rect (&border_box, x, y, width, height);
|
||||||
_gtk_rounded_box_apply_border_radius_for_engine (&border_box, engine, junction);
|
_gtk_rounded_box_apply_border_radius_for_engine (&border_box, engine, junction);
|
||||||
|
Loading…
Reference in New Issue
Block a user