pixbuf engine: clip image parts only around themselves

This commit is contained in:
Daemonratte 2026-10-16 22:58:51 +02:00
commit 92c6e6abf8

View file

@ -657,7 +657,8 @@ pixbuf_render (GdkPixbuf *src,
if (!surface)
return;
cr = gdk_cairo_create (window);
/* only rect is filled: the clip of the window around it is enough */
cr = gdk_cairo_create_in_area_libgtk_only (window, &rect);
cairo_set_source_surface (cr, surface, dest_x, dest_y);
gdk_cairo_rectangle (cr, &rect);
cairo_fill (cr);
@ -687,7 +688,7 @@ pixbuf_render (GdkPixbuf *src,
cairo_destroy (cr);
}
cr = gdk_cairo_create (window);
cr = gdk_cairo_create_in_area_libgtk_only (window, &rect);
gdk_cairo_set_source_pixbuf (cr,
tmp_pixbuf,
-x_offset + rect.x,
@ -1124,15 +1125,17 @@ theme_pixbuf_render (ThemePixbuf *theme_pb,
}
else
{
cairo_t *cr = gdk_cairo_create (window);
GdkRectangle fill = { x, y, width, height };
cairo_t *cr;
if (clip_rect)
fill = *clip_rect;
cr = gdk_cairo_create_in_area_libgtk_only (window, &fill);
gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0);
cairo_pattern_set_extend (cairo_get_source (cr), CAIRO_EXTEND_REPEAT);
if (clip_rect)
gdk_cairo_rectangle (cr, clip_rect);
else
cairo_rectangle (cr, x, y, width, height);
gdk_cairo_rectangle (cr, &fill);
cairo_fill (cr);