[gtk+/gtk-style-context: 523/533] GtkThemingEngine: split background rendering to a private function.
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-style-context: 523/533] GtkThemingEngine: split background rendering to a private function.
- Date: Wed, 1 Dec 2010 02:49:49 +0000 (UTC)
commit a2e5aa35a4c3678edad360f47d9172012ae44517
Author: Carlos Garnacho <carlosg gnome org>
Date: Mon Nov 29 11:24:04 2010 +0100
GtkThemingEngine: split background rendering to a private function.
gtk/gtkthemingengine.c | 84 ++++++++++++++++++++++++++++++-----------------
1 files changed, 53 insertions(+), 31 deletions(-)
---
diff --git a/gtk/gtkthemingengine.c b/gtk/gtkthemingengine.c
index b1db538..4344417 100644
--- a/gtk/gtkthemingengine.c
+++ b/gtk/gtkthemingengine.c
@@ -1284,34 +1284,24 @@ _cairo_round_rectangle_sides (cairo_t *cr,
}
static void
-gtk_theming_engine_render_background (GtkThemingEngine *engine,
- cairo_t *cr,
- gdouble x,
- gdouble y,
- gdouble width,
- gdouble height)
+render_background_internal (GtkThemingEngine *engine,
+ cairo_t *cr,
+ gdouble x,
+ gdouble y,
+ gdouble width,
+ gdouble height,
+ GtkJunctionSides junction)
{
GdkRGBA *bg_color;
cairo_pattern_t *pattern;
GtkStateFlags flags;
gboolean running;
gdouble progress, alpha = 1;
- GtkJunctionSides junction;
gint radius, border_width;
flags = gtk_theming_engine_get_state (engine);
- junction = gtk_theming_engine_get_junction_sides (engine);
cairo_save (cr);
- if (gtk_theming_engine_has_class (engine, "spinbutton") &&
- gtk_theming_engine_has_class (engine, "button"))
- {
- x += 2;
- y += 2;
- width -= 4;
- height -= 4;
- }
-
gtk_theming_engine_get (engine, flags,
"background-image", &pattern,
"background-color", &bg_color,
@@ -1321,18 +1311,6 @@ gtk_theming_engine_render_background (GtkThemingEngine *engine,
running = gtk_theming_engine_state_is_running (engine, GTK_STATE_PRELIGHT, &progress);
- if (border_width > 0)
- {
- x += border_width;
- y += border_width;
- width -= 2 * border_width;
- height -= 2 * border_width;
- radius -= 2 * border_width;
-
- if (radius < 0)
- radius = 0;
- }
-
_cairo_round_rectangle_sides (cr, (gdouble) radius,
x, y, width, height,
SIDE_ALL, junction);
@@ -1502,8 +1480,8 @@ gtk_theming_engine_render_background (GtkThemingEngine *engine,
const GdkRGBA *color, *other_color;
/* Merge just colors */
- color = bg_color;
- other_color = other_bg;
+ color = bg_color;
+ other_color = other_bg;
new_pattern = cairo_pattern_create_rgba (CLAMP (color->red + ((other_color->red - color->red) * progress), 0, 1),
CLAMP (color->green + ((other_color->green - color->green) * progress), 0, 1),
@@ -1551,6 +1529,50 @@ gtk_theming_engine_render_background (GtkThemingEngine *engine,
gdk_rgba_free (bg_color);
}
+static void
+gtk_theming_engine_render_background (GtkThemingEngine *engine,
+ cairo_t *cr,
+ gdouble x,
+ gdouble y,
+ gdouble width,
+ gdouble height)
+{
+ GdkRGBA *bg_color;
+ cairo_pattern_t *pattern;
+ GtkStateFlags flags;
+ gboolean running;
+ gdouble progress, alpha = 1;
+ GtkJunctionSides junction;
+ gint radius, border_width;
+
+ junction = gtk_theming_engine_get_junction_sides (engine);
+
+ if (gtk_theming_engine_has_class (engine, "spinbutton") &&
+ gtk_theming_engine_has_class (engine, "button"))
+ {
+ x += 2;
+ y += 2;
+ width -= 4;
+ height -= 4;
+ }
+
+ gtk_theming_engine_get (engine, flags,
+ "border-width", &border_width,
+ NULL);
+
+ if (border_width > 0)
+ {
+ x += border_width;
+ y += border_width;
+ width -= 2 * border_width;
+ height -= 2 * border_width;
+ }
+
+ render_background_internal (engine, cr,
+ x, y, width, height,
+ junction);
+}
+
/* Renders the small triangle on corners so
* frames with 0 radius have a 3D-like effect
*/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]