GtkThemingEngine: ensure that background isn't rendered past the frame boundaries.

This commit is contained in:
Carlos Garnacho 2010-11-08 20:12:15 +01:00
parent d6ba3b7d89
commit 3d1403e684

View File

@ -1354,7 +1354,7 @@ gtk_theming_engine_render_background (GtkThemingEngine *engine,
gboolean running; gboolean running;
gdouble progress, alpha = 1; gdouble progress, alpha = 1;
GtkJunctionSides junction; GtkJunctionSides junction;
gint radius; gint radius, border_width;
flags = gtk_theming_engine_get_state (engine); flags = gtk_theming_engine_get_state (engine);
junction = gtk_theming_engine_get_junction_sides (engine); junction = gtk_theming_engine_get_junction_sides (engine);
@ -1372,11 +1372,24 @@ gtk_theming_engine_render_background (GtkThemingEngine *engine,
gtk_theming_engine_get (engine, flags, gtk_theming_engine_get (engine, flags,
"background-image", &pattern, "background-image", &pattern,
"background-color", &bg_color, "background-color", &bg_color,
"border-width", &border_width,
"border-radius", &radius, "border-radius", &radius,
NULL); NULL);
running = gtk_theming_engine_state_is_running (engine, GTK_STATE_PRELIGHT, &progress); 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, _cairo_round_rectangle_sides (cr, (gdouble) radius,
x, y, width, height, x, y, width, height,
SIDE_ALL, junction); SIDE_ALL, junction);