mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-01-17 03:40:28 +01:00
image: Manually clip against bounds when rendering directly
This is path is slightly peculiar in that it explicitly avoid the intermediate mask and the geometry is not pre-clipped. This in conjunction with the previous commit fixes: Clip doesn't work for text https://bugs.freedesktop.org/show_bug.cgi?id=29008 which is captured in test/partial-clip-text.
This commit is contained in:
parent
679e5a600b
commit
ef0679333d
1 changed files with 19 additions and 4 deletions
|
|
@ -3939,6 +3939,8 @@ _composite_glyphs (void *closure,
|
|||
|
||||
glyph_surface = scaled_glyph->surface;
|
||||
if (glyph_surface->width && glyph_surface->height) {
|
||||
int x1, y1, x2, y2;
|
||||
|
||||
/* round glyph locations to the nearest pixel */
|
||||
/* XXX: FRAGILE: We're ignoring device_transform scaling here. A bug? */
|
||||
x = _cairo_lround (info->glyphs[i].x -
|
||||
|
|
@ -3946,13 +3948,26 @@ _composite_glyphs (void *closure,
|
|||
y = _cairo_lround (info->glyphs[i].y -
|
||||
glyph_surface->base.device_transform.y0);
|
||||
|
||||
x1 = x;
|
||||
if (x1 < extents->x)
|
||||
x1 = extents->x;
|
||||
x2 = x + glyph_surface->width;
|
||||
if (x2 > extents->x + extents->width)
|
||||
x2 = extents->x + extents->width;
|
||||
|
||||
y1 = y;
|
||||
if (y1 < extents->y)
|
||||
y1 = extents->y;
|
||||
y2 = y + glyph_surface->height;
|
||||
if (y2 > extents->y + extents->height)
|
||||
y2 = extents->y + extents->height;
|
||||
|
||||
pixman_image_composite32 (pixman_op,
|
||||
src, glyph_surface->pixman_image, dst,
|
||||
x + src_x, y + src_y,
|
||||
x1 + src_x, y1 + src_y,
|
||||
0, 0,
|
||||
x - dst_x, y - dst_y,
|
||||
glyph_surface->width,
|
||||
glyph_surface->height);
|
||||
x1 - dst_x, y1 - dst_y,
|
||||
x2 - x1, y2 - y1);
|
||||
}
|
||||
}
|
||||
_cairo_scaled_font_thaw_cache (info->font);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue