[cairo-commit] src/cairo-meta-surface.c src/cairo-surface.c
cworth at kemper.freedesktop.org
Sat Jun 10 11:20:27 PDT 2006
src/cairo-meta-surface.c | 25 ++++++++++++++++---------
src/cairo-surface.c | 20 +++++++++++---------
2 files changed, 27 insertions(+), 18 deletions(-)
diff-tree 2f4210d346d10a2bff9a1ba74e6e9279cd4dddc3 (from d758d5104a09019b65c1b2e93fd5ab80b0e4d056)
Author: Carl Worth <cworth at cworth.org>
Date: Sat Jun 10 11:20:21 2006 -0700
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.
diff --git a/src/cairo-meta-surface.c b/src/cairo-meta-surface.c
index 1ddeed0..3fe6bc2 100644
@@ -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_meta_surface_create (cairo_content_t content,
@@ -537,22 +546,20 @@ _cairo_meta_surface_intersect_clip_path
-/* 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).
_cairo_meta_surface_get_extents (void *abstract_surface,
+ 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;
diff --git a/src/cairo-surface.c b/src/cairo-surface.c
index 0b245f8..5c0e69b 100644
@@ -1634,15 +1634,17 @@ _cairo_surface_set_clip (cairo_surface_t
* @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.
More information about the cairo-commit