mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-04 19:58:08 +02:00
wrapper: Correct translation of clip for wrapper extents
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
cc745f5c2f
commit
4c72c4df66
3 changed files with 47 additions and 15 deletions
|
|
@ -99,6 +99,9 @@ _cairo_clip_copy (const cairo_clip_t *clip);
|
|||
cairo_private cairo_clip_t *
|
||||
_cairo_clip_copy_region (const cairo_clip_t *clip);
|
||||
|
||||
cairo_private cairo_clip_t *
|
||||
_cairo_clip_translate (cairo_clip_t *clip, int tx, int ty);
|
||||
|
||||
cairo_private cairo_clip_t *
|
||||
_cairo_clip_copy_with_translation (const cairo_clip_t *clip, int tx, int ty);
|
||||
|
||||
|
|
|
|||
|
|
@ -386,6 +386,42 @@ _cairo_clip_path_copy_with_translation (cairo_clip_t *clip,
|
|||
return clip;
|
||||
}
|
||||
|
||||
cairo_clip_t *
|
||||
_cairo_clip_translate (cairo_clip_t *clip, int tx, int ty)
|
||||
{
|
||||
int fx, fy, i;
|
||||
cairo_clip_path_t *clip_path;
|
||||
|
||||
if (clip == NULL || _cairo_clip_is_all_clipped (clip))
|
||||
return (cairo_clip_t *)clip;
|
||||
|
||||
if (tx == 0 && ty == 0)
|
||||
return clip;
|
||||
|
||||
fx = _cairo_fixed_from_int (tx);
|
||||
fy = _cairo_fixed_from_int (ty);
|
||||
|
||||
for (i = 0; i < clip->num_boxes; i++) {
|
||||
clip->boxes[i].p1.x += fx;
|
||||
clip->boxes[i].p2.x += fx;
|
||||
clip->boxes[i].p1.y += fy;
|
||||
clip->boxes[i].p2.y += fy;
|
||||
}
|
||||
|
||||
clip->extents.x += tx;
|
||||
clip->extents.y += ty;
|
||||
|
||||
if (clip->path == NULL)
|
||||
return clip;
|
||||
|
||||
clip_path = clip->path;
|
||||
clip->path = NULL;
|
||||
clip = _cairo_clip_path_copy_with_translation (clip, clip_path, fx, fy);
|
||||
_cairo_clip_path_destroy (clip_path);
|
||||
|
||||
return clip;
|
||||
}
|
||||
|
||||
cairo_clip_t *
|
||||
_cairo_clip_copy_with_translation (const cairo_clip_t *clip, int tx, int ty)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -98,18 +98,13 @@ _cairo_surface_wrapper_get_clip (cairo_surface_wrapper_t *wrapper,
|
|||
{
|
||||
cairo_clip_t *copy;
|
||||
|
||||
copy = _cairo_clip_copy_with_translation (clip,
|
||||
-wrapper->extents.x,
|
||||
-wrapper->extents.y);
|
||||
if (wrapper->has_extents) { /* XXX broken. */
|
||||
cairo_rectangle_int_t extents;
|
||||
|
||||
extents.x = extents.y = 0;
|
||||
extents.width = wrapper->extents.width;
|
||||
extents.height = wrapper->extents.height;
|
||||
|
||||
copy = _cairo_clip_intersect_rectangle (copy, &extents);
|
||||
}
|
||||
copy = _cairo_clip_copy (clip);
|
||||
if (wrapper->has_extents)
|
||||
copy = _cairo_clip_intersect_rectangle (copy, &wrapper->extents);
|
||||
if (wrapper->extents.x | wrapper->extents.y)
|
||||
copy = _cairo_clip_translate (copy,
|
||||
-wrapper->extents.x,
|
||||
-wrapper->extents.y);
|
||||
if (wrapper->clip)
|
||||
copy = _cairo_clip_intersect_clip (copy, wrapper->clip);
|
||||
|
||||
|
|
@ -405,9 +400,6 @@ _cairo_surface_wrapper_show_text_glyphs (cairo_surface_wrapper_t *wrapper,
|
|||
if (unlikely (wrapper->target->status))
|
||||
return wrapper->target->status;
|
||||
|
||||
if (glyphs == NULL || num_glyphs == 0)
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
|
||||
dev_clip = _cairo_surface_wrapper_get_clip (wrapper, clip);
|
||||
if (_cairo_clip_is_all_clipped (dev_clip))
|
||||
return CAIRO_INT_STATUS_NOTHING_TO_DO;
|
||||
|
|
@ -571,6 +563,7 @@ _cairo_surface_wrapper_init (cairo_surface_wrapper_t *wrapper,
|
|||
wrapper->target = cairo_surface_reference (target);
|
||||
cairo_matrix_init_identity (&wrapper->transform);
|
||||
wrapper->has_extents = FALSE;
|
||||
wrapper->extents.x = wrapper->extents.y = 0;
|
||||
|
||||
wrapper->needs_transform =
|
||||
! _cairo_matrix_is_identity (&wrapper->target->device_transform);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue