[cairo-commit] cairo/src cairo-gstate-private.h, 1.6,
1.7 cairo-gstate.c, 1.117, 1.118 cairo-pattern.c, 1.32,
1.33 cairo-surface.c, 1.61, 1.62 cairo.c, 1.84, 1.85 cairo.h,
1.106, 1.107 cairoint.h, 1.131, 1.132
Owen Taylor
commit at pdx.freedesktop.org
Mon May 2 13:39:37 PDT 2005
Committed by: otaylor
Update of /cvs/cairo/cairo/src
In directory gabe:/tmp/cvs-serv17943/src
Modified Files:
cairo-gstate-private.h cairo-gstate.c cairo-pattern.c
cairo-surface.c cairo.c cairo.h cairoint.h
Log Message:
2005-04-28 Owen Taylor <otaylor at redhat.com>
* src/cairo-surface.c src/cairoint.h: Add _cairo_surface_begin/end
to save and restore the clip state of a surface. Copy and store
clip regions set on a surface so that we can save and restore them.
* src/cairo.[ch]: Add a CAIRO_STATUS_BAD_NESTING error
for interleaved use of two cairo_t's on the same surface. Also,
add a skeleton doc comment for cairo_status_t.
* src/cairo.c src/cairo-gstate.c src/cairoint.h: Use
_cairo_surface_begin/end to replace
_cairo_gstate_restore_external_state.
* src/cairo-gstate.c: Use _cairo_surface_begin/end to save the
state of a surface when we start drawing at it and restore it
at the end. Check that the save level of the surface is what
we expect on drawing operations and fail with CAIRO_STATUS_BAD_NESTING
otherwise.
* src/cairo-pattern.c src/cairoint.h (_cairo_pattern_acquire_surface_for_surface)
(_cairo_pattern_release_surface): Surround use of pattern->surface
with _cairo_surface->begin/end so we don't clip surfaces used as
sources.
* test/clip-nesting.c test/Makefile.am: Test of destinatin
clipping with the nested creation of cairo_t's for the same
context.
* test/source-clip.c test/Makefile.am: Test that clipping on
a source as a destination doesn't affect use of it as a source.
* test/self-copy.c: XFAIL test for copying from a surface as
a source to itself as a destination with a clip.
Index: cairo-gstate-private.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-gstate-private.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- cairo-gstate-private.h 26 Apr 2005 19:38:06 -0000 1.6
+++ cairo-gstate-private.h 2 May 2005 20:39:33 -0000 1.7
@@ -61,6 +61,7 @@
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;
Index: cairo-gstate.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-gstate.c,v
retrieving revision 1.117
retrieving revision 1.118
diff -u -d -r1.117 -r1.118
--- cairo-gstate.c 2 May 2005 18:01:18 -0000 1.117
+++ cairo-gstate.c 2 May 2005 20:39:33 -0000 1.118
@@ -103,6 +103,7 @@
CAIRO_GSTATE_DEFAULT_FONT_SIZE);
gstate->surface = NULL;
+ gstate->surface_level = 0;
gstate->clip.region = NULL;
gstate->clip.surface = NULL;
@@ -160,8 +161,16 @@
if (status)
goto CLEANUP_FONT;
+ status = _cairo_surface_begin (gstate->surface);
+ if (status)
+ goto CLEANUP_PEN;
+ gstate->surface_level = gstate->surface->level;
+
return status;
+ CLEANUP_PEN:
+ _cairo_pen_fini (&gstate->pen_regular);
+
CLEANUP_FONT:
cairo_scaled_font_destroy (gstate->scaled_font);
gstate->scaled_font = NULL;
@@ -181,9 +190,11 @@
if (gstate->scaled_font)
cairo_scaled_font_destroy (gstate->scaled_font);
- if (gstate->surface)
+ if (gstate->surface) {
+ _cairo_surface_end (gstate->surface);
cairo_surface_destroy (gstate->surface);
- gstate->surface = NULL;
+ gstate->surface = NULL;
+ }
if (gstate->clip.surface)
cairo_surface_destroy (gstate->clip.surface);
@@ -329,20 +340,36 @@
cairo_status_t
_cairo_gstate_set_target_surface (cairo_gstate_t *gstate, cairo_surface_t *surface)
{
+ cairo_status_t status;
+
+ if (gstate->surface == surface)
+ return CAIRO_STATUS_SUCCESS;
+
+ if (surface) {
+ status = _cairo_surface_begin_reset_clip (surface);
+ if (!CAIRO_OK (status))
+ return status;
+ }
+
_cairo_gstate_unset_font (gstate);
- if (gstate->surface)
+ if (gstate->surface) {
+ _cairo_surface_end (gstate->surface);
cairo_surface_destroy (gstate->surface);
+ }
gstate->surface = surface;
/* Sometimes the user wants to return to having no target surface,
* (just like after cairo_create). This can be useful for forcing
* the old surface to be destroyed. */
- if (surface == NULL)
+ if (surface == NULL) {
+ gstate->surface_level = 0;
return CAIRO_STATUS_SUCCESS;
+ }
cairo_surface_reference (gstate->surface);
+ gstate->surface_level = surface->level;
_cairo_gstate_identity_matrix (gstate);
@@ -721,6 +748,9 @@
cairo_status_t status;
cairo_box_t box;
cairo_traps_t traps;
+
+ if (gstate->surface->level != gstate->surface_level)
+ return CAIRO_STATUS_BAD_NESTING;
status = _cairo_surface_get_clip_extents (gstate->surface, &rectangle);
if (!CAIRO_OK (status))
@@ -872,6 +902,9 @@
cairo_status_t status;
int mask_x, mask_y;
+ if (gstate->surface->level != gstate->surface_level)
+ return CAIRO_STATUS_BAD_NESTING;
+
_get_mask_extents (gstate, mask, &extents);
if (gstate->clip.surface) {
@@ -937,6 +970,9 @@
cairo_status_t status;
cairo_traps_t traps;
+ if (gstate->surface->level != gstate->surface_level)
+ return CAIRO_STATUS_BAD_NESTING;
+
if (gstate->line_width <= 0.0)
return CAIRO_STATUS_SUCCESS;
@@ -1405,6 +1441,9 @@
cairo_status_t status;
cairo_traps_t traps;
+ if (gstate->surface->level != gstate->surface_level)
+ return CAIRO_STATUS_BAD_NESTING;
+
_cairo_traps_init (&traps);
status = _cairo_path_fixed_fill_to_traps (path, gstate, &traps);
@@ -1537,6 +1576,9 @@
cairo_status_t
_cairo_gstate_reset_clip (cairo_gstate_t *gstate)
{
+ if (gstate->surface->level != gstate->surface_level)
+ return CAIRO_STATUS_BAD_NESTING;
+
/* destroy any existing clip-region artifacts */
if (gstate->clip.surface)
cairo_surface_destroy (gstate->clip.surface);
@@ -1554,25 +1596,6 @@
return CAIRO_STATUS_SUCCESS;
}
-/* Reset surface clip region to the one in the gstate */
-cairo_status_t
-_cairo_gstate_restore_external_state (cairo_gstate_t *gstate)
-{
- cairo_status_t status;
-
- status = CAIRO_STATUS_SUCCESS;
-
- if (gstate->surface)
- status = _cairo_surface_set_clip_region (gstate->surface,
- gstate->clip.region);
-
- /* If not supported we're already using surface clipping */
- if (status == CAIRO_INT_STATUS_UNSUPPORTED)
- status = CAIRO_STATUS_SUCCESS;
-
- return status;
-}
-
cairo_status_t
_cairo_gstate_clip (cairo_gstate_t *gstate, cairo_path_fixed_t *path)
{
@@ -1582,6 +1605,9 @@
cairo_box_t extents;
pixman_region16_t *region;
+ if (gstate->surface->level != gstate->surface_level)
+ return CAIRO_STATUS_BAD_NESTING;
+
/* Fill the clip region as traps. */
_cairo_traps_init (&traps);
@@ -2130,6 +2156,9 @@
cairo_box_t bbox;
cairo_rectangle_t extents;
+ if (gstate->surface->level != gstate->surface_level)
+ return CAIRO_STATUS_BAD_NESTING;
+
status = _cairo_gstate_ensure_font (gstate);
if (status)
return status;
Index: cairo-pattern.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-pattern.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- cairo-pattern.c 14 Apr 2005 21:42:26 -0000 1.32
+++ cairo-pattern.c 2 May 2005 20:39:33 -0000 1.33
@@ -972,6 +972,7 @@
attr->extend = repeat ? CAIRO_EXTEND_REPEAT : CAIRO_EXTEND_NONE;
attr->filter = CAIRO_FILTER_NEAREST;
attr->acquired = FALSE;
+ attr->clip_saved = FALSE;
return status;
}
@@ -999,6 +1000,7 @@
attribs->extend = CAIRO_EXTEND_REPEAT;
attribs->filter = CAIRO_FILTER_NEAREST;
attribs->acquired = FALSE;
+ attribs->clip_saved = FALSE;
return CAIRO_STATUS_SUCCESS;
}
@@ -1042,21 +1044,36 @@
int tx, ty;
attr->acquired = FALSE;
+ attr->clip_saved = FALSE;
if (_cairo_surface_is_image (dst))
{
cairo_image_surface_t *image;
+ status = _cairo_surface_begin_reset_clip (pattern->surface);
+ if (!CAIRO_OK (status))
+ return status;
+
status = _cairo_surface_acquire_source_image (pattern->surface,
&image,
&attr->extra);
- if (CAIRO_OK (status))
- *out = &image->base;
-
+ if (!CAIRO_OK (status))
+ return status;
+
+ _cairo_surface_end (pattern->surface);
+
+ *out = &image->base;
attr->acquired = TRUE;
}
else
+ {
+ status = _cairo_surface_begin_reset_clip (pattern->surface);
+ if (!CAIRO_OK (status))
+ return status;
+
status = _cairo_surface_clone_similar (dst, pattern->surface, out);
+ _cairo_surface_end (pattern->surface);
+ }
attr->extend = pattern->base.extend;
attr->filter = pattern->base.filter;
@@ -1104,14 +1121,16 @@
cairo_surface_t **surface_out,
cairo_surface_attributes_t *attributes)
{
+ cairo_status_t status;
+
switch (pattern->type) {
case CAIRO_PATTERN_SOLID: {
cairo_solid_pattern_t *src = (cairo_solid_pattern_t *) pattern;
- return _cairo_pattern_acquire_surface_for_solid (src, dst,
- x, y, width, height,
- surface_out,
- attributes);
+ status = _cairo_pattern_acquire_surface_for_solid (src, dst,
+ x, y, width, height,
+ surface_out,
+ attributes);
} break;
case CAIRO_PATTERN_LINEAR:
case CAIRO_PATTERN_RADIAL: {
@@ -1130,30 +1149,43 @@
_cairo_pattern_init_solid (&solid, color);
- return _cairo_pattern_acquire_surface_for_solid (&solid, dst,
- x, y,
- width, height,
- surface_out,
- attributes);
+ status = _cairo_pattern_acquire_surface_for_solid (&solid, dst,
+ x, y,
+ width, height,
+ surface_out,
+ attributes);
}
else
- return _cairo_pattern_acquire_surface_for_gradient (src, dst,
- x, y,
- width, height,
- surface_out,
- attributes);
+ status = _cairo_pattern_acquire_surface_for_gradient (src, dst,
+ x, y,
+ width, height,
+ surface_out,
+ attributes);
} break;
case CAIRO_PATTERN_SURFACE: {
cairo_surface_pattern_t *src = (cairo_surface_pattern_t *) pattern;
- return _cairo_pattern_acquire_surface_for_surface (src, dst,
- x, y, width, height,
- surface_out,
- attributes);
+ status = _cairo_pattern_acquire_surface_for_surface (src, dst,
+ x, y, width, height,
+ surface_out,
+ attributes);
} break;
+ default:
+ status = CAIRO_INT_STATUS_UNSUPPORTED;
}
- return CAIRO_INT_STATUS_UNSUPPORTED;
+
+ if (CAIRO_OK (status) && (*surface_out)->clip_region) {
+ status = _cairo_surface_begin_reset_clip (*surface_out);
+ if (!CAIRO_OK (status)) {
+ _cairo_pattern_release_surface (dst, *surface_out, attributes);
+ return status;
+ }
+
+ attributes->clip_saved = TRUE;
+ }
+
+ return status;
}
/**
@@ -1169,11 +1201,15 @@
cairo_surface_t *surface,
cairo_surface_attributes_t *attributes)
{
+ if (attributes->clip_saved)
+ _cairo_surface_end (surface);
+
if (attributes->acquired)
+ {
_cairo_surface_release_source_image (dst,
(cairo_image_surface_t *) surface,
attributes->extra);
- else
+ } else
cairo_surface_destroy (surface);
}
Index: cairo-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-surface.c,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -d -r1.61 -r1.62
--- cairo-surface.c 21 Apr 2005 22:18:14 -0000 1.61
+++ cairo-surface.c 2 May 2005 20:39:33 -0000 1.62
@@ -39,6 +39,17 @@
#include "cairoint.h"
+struct _cairo_surface_save {
+ cairo_surface_save_t *next;
+ pixman_region16_t *clip_region;
+};
+
+static cairo_status_t
+_cairo_surface_set_clip_region_internal (cairo_surface_t *surface,
+ pixman_region16_t *region,
+ cairo_bool_t copy_region,
+ cairo_bool_t free_existing);
+
void
_cairo_surface_init (cairo_surface_t *surface,
const cairo_surface_backend_t *backend)
@@ -57,11 +68,110 @@
surface->device_x_offset = 0;
surface->device_y_offset = 0;
- surface->is_clipped = 0;
- surface->clip_extents.x = 0;
- surface->clip_extents.y = 0;
- surface->clip_extents.width = 0;
- surface->clip_extents.height = 0;
+ surface->clip_region = NULL;
+
+ surface->saves = NULL;
+ surface->level = 0;
+}
+
+static cairo_status_t
+_cairo_surface_begin_internal (cairo_surface_t *surface,
+ cairo_bool_t reset_clip)
+{
+ cairo_surface_save_t *save;
+
+ if (surface->finished)
+ return CAIRO_STATUS_SURFACE_FINISHED;
+
+ save = malloc (sizeof (cairo_surface_save_t));
+ if (!save)
+ return CAIRO_STATUS_NO_MEMORY;
+
+ if (surface->clip_region) {
+ if (reset_clip)
+ {
+ cairo_status_t status;
+
+ save->clip_region = surface->clip_region;
+ status = _cairo_surface_set_clip_region_internal (surface, NULL, FALSE, FALSE);
+ if (!CAIRO_OK (status)) {
+ free (save);
+ return status;
+ }
+ }
+ else
+ {
+ save->clip_region = pixman_region_create ();
+ pixman_region_copy (save->clip_region, surface->clip_region);
+ }
+ } else {
+ save->clip_region = NULL;
+ }
+
+ save->next = surface->saves;
+ surface->saves = save;
+ surface->level++;
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+/**
+ * _cairo_surface_begin:
+ * @surface: a #cairo_surface_t
+ *
+ * Must be called before beginning to use the surface. State
+ * of the surface like the clip region will be saved then restored
+ * on the matching call _cairo_surface_end().
+ */
+cairo_private cairo_status_t
+_cairo_surface_begin (cairo_surface_t *surface)
+{
+ return _cairo_surface_begin_internal (surface, FALSE);
+}
+
+/**
+ * _cairo_surface_begin_reset_clip:
+ * @surface: a #cairo_surface_t
+ *
+ * Must be called before beginning to use the surface. State
+ * of the surface like the clip region will be saved then restored
+ * on the matching call _cairo_surface_end().
+ *
+ * After the state is saved, the clip region is cleared. This
+ * combination of operations is a little artificial; the caller could
+ * simply call _cairo_surface_set_clip_region (surface, NULL); after
+ * _cairo_surface_save(). Combining the two saves a copy of the clip
+ * region, and also simplifies error handling for the caller.
+ **/
+cairo_private cairo_status_t
+_cairo_surface_begin_reset_clip (cairo_surface_t *surface)
+{
+ return _cairo_surface_begin_internal (surface, TRUE);
+}
+
+/**
+ * _cairo_surface_end:
+ * @surface: a #cairo_surface_t
+ *
+ * Restores any state saved by _cairo_surface_begin()
+ **/
+cairo_private cairo_status_t
+_cairo_surface_end (cairo_surface_t *surface)
+{
+ cairo_surface_save_t *save;
+ pixman_region16_t *clip_region;
+
+ if (!surface->saves)
+ return CAIRO_STATUS_BAD_NESTING;
+
+ save = surface->saves;
+ surface->saves = save->next;
+ surface->level--;
+
+ clip_region = save->clip_region;
+ free (save);
+
+ return _cairo_surface_set_clip_region_internal (surface, clip_region, FALSE, TRUE);
}
cairo_surface_t *
@@ -176,6 +286,14 @@
if (surface->finished)
return CAIRO_STATUS_SURFACE_FINISHED;
+ if (surface->saves)
+ return CAIRO_STATUS_BAD_NESTING;
+
+ if (surface->clip_region) {
+ pixman_region_destroy (surface->clip_region);
+ surface->clip_region = NULL;
+ }
+
if (surface->backend->finish) {
status = surface->backend->finish (surface);
if (status)
@@ -855,43 +973,60 @@
return surface->backend->show_page (surface);
}
-cairo_status_t
-_cairo_surface_set_clip_region (cairo_surface_t *surface,
- pixman_region16_t *region)
+static cairo_status_t
+_cairo_surface_set_clip_region_internal (cairo_surface_t *surface,
+ pixman_region16_t *region,
+ cairo_bool_t copy_region,
+ cairo_bool_t free_existing)
{
- pixman_box16_t *box;
-
if (surface->finished)
return CAIRO_STATUS_SURFACE_FINISHED;
+ if (region == surface->clip_region)
+ return CAIRO_STATUS_SUCCESS;
+
if (surface->backend->set_clip_region == NULL)
return CAIRO_INT_STATUS_UNSUPPORTED;
- if (region) {
- box = pixman_region_extents (region);
-
- surface->clip_extents.x = box->x1;
- surface->clip_extents.y = box->y1;
- surface->clip_extents.width = box->x2 - box->x1;
- surface->clip_extents.height = box->y2 - box->y1;
-
- surface->is_clipped = 1;
- } else {
- surface->is_clipped = 0;
+ if (surface->clip_region) {
+ if (free_existing)
+ pixman_region_destroy (surface->clip_region);
+ surface->clip_region = NULL;
}
+ if (region) {
+ if (copy_region) {
+ surface->clip_region = pixman_region_create ();
+ pixman_region_copy (surface->clip_region, region);
+ } else
+ surface->clip_region = region;
+ }
+
return surface->backend->set_clip_region (surface, region);
}
cairo_status_t
+_cairo_surface_set_clip_region (cairo_surface_t *surface,
+ pixman_region16_t *region)
+{
+ return _cairo_surface_set_clip_region_internal (surface, region, TRUE, TRUE);
+}
+
+cairo_status_t
_cairo_surface_get_clip_extents (cairo_surface_t *surface,
cairo_rectangle_t *rectangle)
{
if (surface->finished)
return CAIRO_STATUS_SURFACE_FINISHED;
- if (surface->is_clipped) {
- *rectangle = surface->clip_extents;
+ if (surface->clip_region) {
+ pixman_box16_t *box = pixman_region_extents (surface->clip_region);
+
+ rectangle->x = box->x1;
+ rectangle->y = box->y1;
+ rectangle->width = box->x2 - box->x1;
+ rectangle->height = box->y2 - box->y1;
+
return CAIRO_STATUS_SUCCESS;
}
Index: cairo.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo.c,v
retrieving revision 1.84
retrieving revision 1.85
diff -u -d -r1.84 -r1.85
--- cairo.c 2 May 2005 18:01:18 -0000 1.84
+++ cairo.c 2 May 2005 20:39:33 -0000 1.85
@@ -226,8 +226,6 @@
if (cr->status)
return;
- cr->status = _cairo_gstate_restore_external_state (cr->gstate);
-
CAIRO_CHECK_SANITY (cr);
}
slim_hidden_def(cairo_restore);
@@ -301,6 +299,16 @@
* will be referenced by the #cairo_t, so you can immediately
* call cairo_surface_destroy() on it if you don't need to
* keep a reference to it around.
+ *
+ * Note that there are restrictions on using the same surface in
+ * multiple contexts at the same time. If, after setting @surface as
+ * the target surface of @cr_a, you set it as the target surface of
+ * @cr_b, you must finish using @cr_b and unset the target surface
+ * before resuming using @cr_a. Unsetting the target surface happens
+ * automatically when the last reference to the context is released
+ * with cairo_destroy(), or you can call cairo_set_target_surface
+ * (@cr_b, %NULL) explicitly. See also the %CAIRO_STATUS_BAD_NESTING
+ * status.
**/
void
cairo_set_target_surface (cairo_t *cr, cairo_surface_t *surface)
@@ -2628,6 +2636,8 @@
return "the target surface has been finished";
case CAIRO_STATUS_SURFACE_TYPE_MISMATCH:
return "the surface type is not appropriate for the operation";
+ case CAIRO_STATUS_BAD_NESTING:
+ return "drawing operations interleaved for two contexts for the same surface";
}
return "<unknown error status>";
Index: cairo.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo.h,v
retrieving revision 1.106
retrieving revision 1.107
diff -u -d -r1.106 -r1.107
--- cairo.h 2 May 2005 18:01:18 -0000 1.106
+++ cairo.h 2 May 2005 20:39:33 -0000 1.107
@@ -124,6 +124,32 @@
int unused;
} cairo_user_data_key_t;
+/**
+ * cairo_status_t
+ * @CAIRO_STATUS_SUCCESS: no error has occurred
+ * @CAIRO_STATUS_NO_MEMORY:
+ * @CAIRO_STATUS_INVALID_RESTORE:
+ * @CAIRO_STATUS_INVALID_POP_GROUP:
+ * @CAIRO_STATUS_INVALID_MATRIX:
+ * @CAIRO_STATUS_NO_TARGET_SURFACE:
+ * @CAIRO_STATUS_NULL_POINTER:
+ * @CAIRO_STATUS_INVALID_STRING:
+ * @CAIRO_STATUS_INVALID_PATH_DATA:
+ * @CAIRO_STATUS_READ_ERROR:
+ * @CAIRO_STATUS_WRITE_ERROR:
+ * @CAIRO_STATUS_SURFACE_FINISHED:
+ * @CAIRO_STATUS_SURFACE_TYPE_MISMATCH:
+ * @CAIRO_STATUS_BAD_NESTING: the same surface was used as the
+ * target surface for two different cairo contexts at once,
+ * and more drawing was done on the first context before the
+ * surface was unset as the target for the second context.
+ * See the documentation for cairo_set_target_surface()
+ *
+ * #cairo_status_t is used to indicate errors that can occur when
+ * using Cairo. In some cases it is returned directly by functions.
+ * but when using #cairo_t, the last error, if any, is stored in
+ * the context and can be retrieved with cairo_status().
+ **/
typedef enum cairo_status {
CAIRO_STATUS_SUCCESS = 0,
CAIRO_STATUS_NO_MEMORY,
@@ -138,7 +164,8 @@
CAIRO_STATUS_READ_ERROR,
CAIRO_STATUS_WRITE_ERROR,
CAIRO_STATUS_SURFACE_FINISHED,
- CAIRO_STATUS_SURFACE_TYPE_MISMATCH
+ CAIRO_STATUS_SURFACE_TYPE_MISMATCH,
+ CAIRO_STATUS_BAD_NESTING
} cairo_status_t;
/**
Index: cairoint.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairoint.h,v
retrieving revision 1.131
retrieving revision 1.132
diff -u -d -r1.131 -r1.132
--- cairoint.h 2 May 2005 18:01:18 -0000 1.131
+++ cairoint.h 2 May 2005 20:39:33 -0000 1.132
@@ -690,6 +690,8 @@
unsigned long blue_mask;
} cairo_format_masks_t;
+typedef struct _cairo_surface_save cairo_surface_save_t;
+
struct _cairo_surface {
const cairo_surface_backend_t *backend;
@@ -704,8 +706,10 @@
double device_x_offset;
double device_y_offset;
- int is_clipped;
- cairo_rectangle_t clip_extents;
+ cairo_surface_save_t *saves; /* Stack of saved states from cairo_surface_begin/end() */
+ int level; /* Number saved states */
+
+ pixman_region16_t *clip_region;
};
struct _cairo_image_surface {
@@ -827,6 +831,7 @@
int x_offset;
int y_offset;
cairo_bool_t acquired;
+ cairo_bool_t clip_saved;
void *extra;
} cairo_surface_attributes_t;
@@ -1100,9 +1105,6 @@
_cairo_gstate_reset_clip (cairo_gstate_t *gstate);
cairo_private cairo_status_t
-_cairo_gstate_restore_external_state (cairo_gstate_t *gstate);
-
-cairo_private cairo_status_t
_cairo_gstate_show_surface (cairo_gstate_t *gstate,
cairo_surface_t *surface,
double x,
@@ -1394,6 +1396,15 @@
const cairo_surface_backend_t *backend);
cairo_private cairo_status_t
+_cairo_surface_begin (cairo_surface_t *surface);
+
+cairo_private cairo_status_t
+_cairo_surface_begin_reset_clip (cairo_surface_t *surface);
+
+cairo_private cairo_status_t
+_cairo_surface_end (cairo_surface_t *surface);
+
+cairo_private cairo_status_t
_cairo_surface_fill_rectangle (cairo_surface_t *surface,
cairo_operator_t operator,
const cairo_color_t *color,
More information about the cairo-commit
mailing list