Commit 65166c36 authored by Cosimo Cecchi's avatar Cosimo Cecchi

themingbackground: fix drawing for repeating positioned images

When we determine the fill rectangle for an image layer, and the image
is not repeating, we should also position the rectangle according to the
values of background-position, or we will always fill a tiny slice at
the top/left of the clip box.

https://bugzilla.gnome.org/show_bug.cgi?id=677109
parent bce34d80
......@@ -196,6 +196,7 @@ _gtk_theming_background_paint_layer (GtkThemingBackground *bg,
else
{
int surface_width, surface_height;
cairo_rectangle_t fill_rect;
cairo_surface_t *surface;
cairo_t *cr2;
......@@ -272,10 +273,30 @@ _gtk_theming_background_paint_layer (GtkThemingBackground *bg,
cairo_pattern_set_extend (cairo_get_source (cr), CAIRO_EXTEND_REPEAT);
cairo_surface_destroy (surface);
cairo_rectangle (cr,
0, 0,
hrepeat == GTK_CSS_REPEAT_STYLE_NO_REPEAT ? image_width : width,
vrepeat == GTK_CSS_REPEAT_STYLE_NO_REPEAT ? image_height : height);
if (hrepeat == GTK_CSS_REPEAT_STYLE_NO_REPEAT)
{
fill_rect.x = _gtk_css_position_value_get_x (pos, width - image_width);
fill_rect.width = image_width;
}
else
{
fill_rect.x = 0;
fill_rect.width = width;
}
if (vrepeat == GTK_CSS_REPEAT_STYLE_NO_REPEAT)
{
fill_rect.y = _gtk_css_position_value_get_y (pos, height - image_height);
fill_rect.height = image_height;
}
else
{
fill_rect.y = 0;
fill_rect.height = height;
}
cairo_rectangle (cr, fill_rect.x, fill_rect.y,
fill_rect.width, fill_rect.height);
cairo_fill (cr);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment