mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-05 05:18:01 +02:00
Change _cairo_meta_surface_get_extents to return a bounded size.
The old behavior of returning "infinite" extents is inconsistent with the current usage of meta-surface where it is always created for replay against a particular (sized) target surface and that size is passed to _cairo_meta_surface_create. Also clarify documentation of _cairo_surface_get_extents to eliminate the possibility of inifinite extents.
This commit is contained in:
parent
d758d5104a
commit
2f4210d346
2 changed files with 27 additions and 18 deletions
|
|
@ -59,6 +59,15 @@
|
|||
|
||||
static const cairo_surface_backend_t cairo_meta_surface_backend;
|
||||
|
||||
/* Currently all meta surfaces do have a size which should be passed
|
||||
* in as the maximum size of any target surface against which the
|
||||
* meta-surface will ever be replayed.
|
||||
*
|
||||
* XXX: The naming of "pixels" in the size here is a misnomer. It's
|
||||
* actually a size in whatever device-space units are desired (again,
|
||||
* according to the intended replay target). This should likely also
|
||||
* be changed to use doubles not ints.
|
||||
*/
|
||||
cairo_surface_t *
|
||||
_cairo_meta_surface_create (cairo_content_t content,
|
||||
int width_pixels,
|
||||
|
|
@ -537,22 +546,20 @@ _cairo_meta_surface_intersect_clip_path (void *dst,
|
|||
return CAIRO_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/* A meta-surface is logically unbounded, but when it is used as a
|
||||
* source, the drawing code can optimize based on the extents of the
|
||||
* surface.
|
||||
*
|
||||
* XXX: The optimization being attempted here would only actually work
|
||||
* if the meta-surface kept track of its extents as commands were
|
||||
* added to it.
|
||||
/* Currently, we're using as the "size" of a meta surface the largest
|
||||
* surface size against which the meta-surface is expected to be
|
||||
* replayed, (as passed in to _cairo_meta_surface_create).
|
||||
*/
|
||||
static cairo_int_status_t
|
||||
_cairo_meta_surface_get_extents (void *abstract_surface,
|
||||
cairo_rectangle_int16_t *rectangle)
|
||||
{
|
||||
cairo_meta_surface_t *surface = abstract_surface;
|
||||
|
||||
rectangle->x = 0;
|
||||
rectangle->y = 0;
|
||||
rectangle->width = INT16_MAX;
|
||||
rectangle->height = INT16_MAX;
|
||||
rectangle->width = surface->width_pixels;
|
||||
rectangle->height = surface->height_pixels;
|
||||
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1634,15 +1634,17 @@ _cairo_surface_set_clip (cairo_surface_t *surface, cairo_clip_t *clip)
|
|||
* _cairo_surface_get_extents:
|
||||
* @surface: the #cairo_surface_t to fetch extents for
|
||||
*
|
||||
* This function returns a bounding box for the surface. The
|
||||
* surface bounds are defined as a region beyond which no
|
||||
* rendering will possibly be recorded, in otherwords,
|
||||
* it is the maximum extent of potentially usable
|
||||
* coordinates. For simple pixel-based surfaces,
|
||||
* it can be a close bound on the retained pixel
|
||||
* region. For virtual surfaces (PDF et al), it
|
||||
* cannot and must extend to the reaches of the
|
||||
* target system coordinate space.
|
||||
* This function returns a bounding box for the surface. The surface
|
||||
* bounds are defined as a region beyond which no rendering will
|
||||
* possibly be recorded, in otherwords, it is the maximum extent of
|
||||
* potentially usable coordinates.
|
||||
*
|
||||
* For simple pixel-based surfaces, it can be a close bound on the
|
||||
* retained pixel region.
|
||||
*
|
||||
* For vector surfaces, (PDF, PS, SVG and meta-surfaces), the surface
|
||||
* might be conceived as unbounded, but we force the user to provide a
|
||||
* maximum size at the time of surface_create.
|
||||
*/
|
||||
|
||||
cairo_status_t
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue