GtkThemingEngine: split background rendering to a private function.

This commit is contained in:
Carlos Garnacho 2010-11-29 11:24:04 +01:00
parent 4c1a2426d4
commit 32c2b13969

View File

@ -1284,34 +1284,24 @@ _cairo_round_rectangle_sides (cairo_t *cr,
}
static void
gtk_theming_engine_render_background (GtkThemingEngine *engine,
render_background_internal (GtkThemingEngine *engine,
cairo_t *cr,
gdouble x,
gdouble y,
gdouble width,
gdouble height)
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);
@ -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
*/