mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-11 11:20:12 +00:00
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
This commit is contained in:
parent
bce34d80d4
commit
65166c36b9
@ -196,6 +196,7 @@ _gtk_theming_background_paint_layer (GtkThemingBackground *bg,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
int surface_width, surface_height;
|
int surface_width, surface_height;
|
||||||
|
cairo_rectangle_t fill_rect;
|
||||||
cairo_surface_t *surface;
|
cairo_surface_t *surface;
|
||||||
cairo_t *cr2;
|
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_pattern_set_extend (cairo_get_source (cr), CAIRO_EXTEND_REPEAT);
|
||||||
cairo_surface_destroy (surface);
|
cairo_surface_destroy (surface);
|
||||||
|
|
||||||
cairo_rectangle (cr,
|
if (hrepeat == GTK_CSS_REPEAT_STYLE_NO_REPEAT)
|
||||||
0, 0,
|
{
|
||||||
hrepeat == GTK_CSS_REPEAT_STYLE_NO_REPEAT ? image_width : width,
|
fill_rect.x = _gtk_css_position_value_get_x (pos, width - image_width);
|
||||||
vrepeat == GTK_CSS_REPEAT_STYLE_NO_REPEAT ? image_height : height);
|
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);
|
cairo_fill (cr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user