[gtk+] themingengine: don't use gtk_theming_engine_get()
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] themingengine: don't use gtk_theming_engine_get()
- Date: Thu, 17 May 2012 02:07:22 +0000 (UTC)
commit f2da5f30c190b183a76a531bd434b5c25917361b
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Wed May 16 18:27:21 2012 -0400
themingengine: don't use gtk_theming_engine_get()
This also avoids some useless GdkRGBA heap allocations when drawing a
border.
gtk/gtkthemingengine.c | 39 +++++++++++++--------------------------
1 files changed, 13 insertions(+), 26 deletions(-)
---
diff --git a/gtk/gtkthemingengine.c b/gtk/gtkthemingengine.c
index 78b00c2..b4e2538 100644
--- a/gtk/gtkthemingengine.c
+++ b/gtk/gtkthemingengine.c
@@ -1050,10 +1050,8 @@ gtk_theming_engine_render_check (GtkThemingEngine *engine,
gtk_theming_engine_get_color (engine, flags, &fg_color);
gtk_theming_engine_get_background_color (engine, flags, &bg_color);
gtk_theming_engine_get_border (engine, flags, &border);
-
- gtk_theming_engine_get (engine, flags,
- "border-style", &border_style,
- NULL);
+ border_style = _gtk_css_border_style_value_get
+ (_gtk_theming_engine_peek_property (engine, GTK_CSS_PROPERTY_BORDER_TOP_STYLE));
border_width = MIN (MIN (border.top, border.bottom),
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_background_color (engine, flags, &bg_color);
gtk_theming_engine_get_border (engine, flags, &border);
-
- gtk_theming_engine_get (engine, flags,
- "border-style", &border_style,
- NULL);
+ border_style = _gtk_css_border_style_value_get
+ (_gtk_theming_engine_peek_property (engine, GTK_CSS_PROPERTY_BORDER_TOP_STYLE));
exterior_size = MIN (width, height);
border_width = MIN (MIN (border.top, border.bottom),
@@ -1741,9 +1737,7 @@ render_frame_internal (GtkThemingEngine *engine,
GtkBorderStyle border_style[4];
GtkRoundedBox border_box;
GtkBorder border;
- GdkRGBA *alloc_colors[4];
GdkRGBA colors[4];
- guint i;
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);
else
{
- gtk_theming_engine_get (engine, state,
- "border-top-style", &border_style[0],
- "border-right-style", &border_style[1],
- "border-bottom-style", &border_style[2],
- "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[i] = *alloc_colors[i];
- gdk_rgba_free (alloc_colors[i]);
- }
+ border_style[0] = _gtk_css_border_style_value_get (_gtk_theming_engine_peek_property (engine, GTK_CSS_PROPERTY_BORDER_TOP_STYLE));
+ border_style[1] = _gtk_css_border_style_value_get (_gtk_theming_engine_peek_property (engine, GTK_CSS_PROPERTY_BORDER_RIGHT_STYLE));
+ border_style[2] = _gtk_css_border_style_value_get (_gtk_theming_engine_peek_property (engine, GTK_CSS_PROPERTY_BORDER_BOTTOM_STYLE));
+ border_style[3] = _gtk_css_border_style_value_get (_gtk_theming_engine_peek_property (engine, GTK_CSS_PROPERTY_BORDER_LEFT_STYLE));
+
+ 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[2] = *_gtk_css_rgba_value_get_rgba (_gtk_theming_engine_peek_property (engine, GTK_CSS_PROPERTY_BORDER_BOTTOM_COLOR));
+ 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_apply_border_radius_for_engine (&border_box, engine, junction);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]