record: Offset the clip by the replay transformation as well

Fixes push-group-offset which reduces to a replay of a recording surface
inside a recording surface and forgot to offset the clip imposed by the
extents of the first recording surface into device space.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2011-08-14 14:45:00 +01:00
parent eb09a68638
commit 0053a44f6b
4 changed files with 24 additions and 23 deletions

View file

@ -184,7 +184,18 @@ _cairo_recording_surface_get_bounds (cairo_surface_t *surface,
return TRUE;
}
cairo_private cairo_bool_t
_cairo_surface_is_recording (const cairo_surface_t *surface);
/**
* _cairo_surface_is_recording:
* @surface: a #cairo_surface_t
*
* Checks if a surface is a #cairo_recording_surface_t
*
* Return value: %TRUE if the surface is a recording surface
**/
static inline cairo_bool_t
_cairo_surface_is_recording (const cairo_surface_t *surface)
{
return surface->backend->type == CAIRO_SURFACE_TYPE_RECORDING;
}
#endif /* CAIRO_RECORDING_SURFACE_H */

View file

@ -1147,20 +1147,6 @@ _cairo_recording_surface_get_extents (void *abstract_surface,
return TRUE;
}
/**
* _cairo_surface_is_recording:
* @surface: a #cairo_surface_t
*
* Checks if a surface is a #cairo_recording_surface_t
*
* Return value: %TRUE if the surface is a recording surface
**/
cairo_bool_t
_cairo_surface_is_recording (const cairo_surface_t *surface)
{
return surface->backend == &cairo_recording_surface_backend;
}
static const cairo_surface_backend_t cairo_recording_surface_backend = {
CAIRO_SURFACE_TYPE_RECORDING,
_cairo_recording_surface_finish,

View file

@ -120,12 +120,19 @@ _cairo_surface_wrapper_get_clip (cairo_surface_wrapper_t *wrapper,
cairo_clip_t *copy;
copy = _cairo_clip_copy (clip);
if (wrapper->has_extents)
if (wrapper->has_extents) {
copy = _cairo_clip_intersect_rectangle (copy, &wrapper->extents);
if (wrapper->extents.x | wrapper->extents.y)
if (wrapper->extents.x | wrapper->extents.y)
copy = _cairo_clip_translate (copy,
-wrapper->extents.x,
-wrapper->extents.y);
}
if (! _cairo_matrix_is_identity (&wrapper->transform)) {
/* XXX */
copy = _cairo_clip_translate (copy,
-wrapper->extents.x,
-wrapper->extents.y);
wrapper->transform.x0,
wrapper->transform.y0);
}
if (! _cairo_matrix_is_identity (&wrapper->target->device_transform)) {
/* XXX */
copy = _cairo_clip_translate (copy,

View file

@ -2001,9 +2001,6 @@ _cairo_image_analyze_color (cairo_image_surface_t *image);
cairo_private cairo_bool_t
_cairo_surface_is_image (const cairo_surface_t *surface) cairo_pure;
cairo_private cairo_bool_t
_cairo_surface_is_recording (const cairo_surface_t *surface) cairo_pure;
/* cairo-pen.c */
cairo_private cairo_status_t
_cairo_pen_init (cairo_pen_t *pen,