summaryrefslogtreecommitdiff
path: root/src/cairo-gstate-private.h
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2005-05-26 11:35:44 +0000
committerKeith Packard <keithp@keithp.com>2005-05-26 11:35:44 +0000
commit45a966f69528c86dd6e3d4736805803b80de9f9b (patch)
treeaab7935e6367421d168dfda9bee057e6c2fca238 /src/cairo-gstate-private.h
parentbe903f4c2232bfa8b48c1dca60ad5cf65f403c77 (diff)
Replace nesting-only surface clipping with gstate contained serial-number tracked clipping sets that are loaded into the surface on demand just before each rendering operation. This permits multiple cairo_t contexts to reference a surface without regard to ordering of operations among the contexts.
Also in this patch is a change to the xlib surface that creates two separate Pictures, one for source and one for destination operands which separates the source clipping from destination clipping. Cairo now specifies that sources are never clipped by any clipping applied to them as destinations. Move cairo_clip_t (renamed from cairo_clip_rec_t) from cairoint.h to cairo-gstate-private.h. Eliminate stack of clip state from surfaces. Add new surface clipping API. Manage clip objects entirely within the gstate, loading the whole thing into the surface just before drawing. Source surfaces need not have clipping modified as the surface interface now specifies that source surfaces are always unclipped. Eliminate nested clipping contexts, leaving clip management entirely to the gstate. Create new clip API for the gstate which uses per-surface serial numbers to match gstate clipping against current surface clipping values. Surfaces no longer track clipping regions at all, so the old _cairo_surface_get_clip_extents has been replaced with _cairo_surface_get_extents. For PDF/PS surfaces, this function is expected to return a rectangle covering the entire fixed point coordinate space to leave rendering unclipped by the surface. Region clipping capability is now signalled by a non-NULL function pointer in set_clip_region. Each surface now contains two Pictures, one for source and one for destination operands so that source operands are never clipped by destination clipping. CAIRO_STATUS_BAD_NESTING removed self-copy now passes (Xlib only, until libpixman changes land) reviewed by: krh, otaylor, cworth
Diffstat (limited to 'src/cairo-gstate-private.h')
-rw-r--r--src/cairo-gstate-private.h30
1 files changed, 28 insertions, 2 deletions
diff --git a/src/cairo-gstate-private.h b/src/cairo-gstate-private.h
index eeb35b83..03486ac9 100644
--- a/src/cairo-gstate-private.h
+++ b/src/cairo-gstate-private.h
@@ -36,6 +36,33 @@
#ifndef CAIRO_GSTATE_PRIVATE_H
#define CAIRO_GSTATE_PRIVATE_H
+typedef struct _cairo_clip {
+ /*
+ * Mask-based clipping for cases where the backend
+ * clipping isn't sufficiently able.
+ *
+ * The rectangle here represents the
+ * portion of the destination surface that this
+ * clip surface maps to, it does not
+ * represent the extents of the clip region or
+ * clip paths
+ */
+ cairo_surface_t *surface;
+ cairo_rectangle_t surface_rect;
+ /*
+ * Surface clip serial number to store
+ * in the surface when this clip is set
+ */
+ unsigned int serial;
+ /*
+ * A clip region that can be placed in the surface
+ */
+ pixman_region16_t *region;
+ /*
+ * XXX add clip paths here
+ */
+} cairo_clip_t;
+
struct _cairo_gstate {
cairo_operator_t operator;
@@ -61,11 +88,10 @@ struct _cairo_gstate {
cairo_scaled_font_t *scaled_font; /* Specific to the current CTM */
cairo_surface_t *surface;
- int surface_level; /* Used to detect bad nested use */
cairo_pattern_t *source;
- cairo_clip_rec_t clip;
+ cairo_clip_t clip;
cairo_matrix_t font_matrix;