diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2012-05-31 18:30:58 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2012-05-31 18:30:58 +0100 |
commit | c0a92bf8329c5a8aee76ac96034435d4fce043dc (patch) | |
tree | 7f5ac1c53f76cf8d785937f4cf4ad8f741ed9da0 | |
parent | 9e933d4b8790f0f8309bdd980f4558d51ccec168 (diff) |
surface: replace map-to-image clone's use of user_data with parent pointer
Removes an another undeclared PLT entry and prevents mixing of user_data
with internal state.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/cairo-image-surface-inline.h | 6 | ||||
-rw-r--r-- | src/cairo-image-surface-private.h | 3 | ||||
-rw-r--r-- | src/cairo-image-surface.c | 12 |
3 files changed, 7 insertions, 14 deletions
diff --git a/src/cairo-image-surface-inline.h b/src/cairo-image-surface-inline.h index 132d553a..f6bed719 100644 --- a/src/cairo-image-surface-inline.h +++ b/src/cairo-image-surface-inline.h @@ -56,6 +56,12 @@ _cairo_image_surface_set_parent (cairo_image_surface_t *image, image->parent = parent; } +static inline cairo_bool_t +_cairo_image_surface_is_clone (cairo_image_surface_t *image) +{ + return image->parent != NULL; +} + /** * _cairo_surface_is_image: * @surface: a #cairo_surface_t diff --git a/src/cairo-image-surface-private.h b/src/cairo-image-surface-private.h index 8f7364cb..96601808 100644 --- a/src/cairo-image-surface-private.h +++ b/src/cairo-image-surface-private.h @@ -220,9 +220,6 @@ cairo_private cairo_image_surface_t * _cairo_image_surface_clone_subimage (cairo_surface_t *surface, const cairo_rectangle_int_t *extents); -cairo_private cairo_bool_t -_cairo_image_surface_is_clone (cairo_image_surface_t *surface); - CAIRO_END_DECLS #endif /* CAIRO_IMAGE_SURFACE_PRIVATE_H */ diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c index 33170cd3..23e6ca67 100644 --- a/src/cairo-image-surface.c +++ b/src/cairo-image-surface.c @@ -1206,8 +1206,6 @@ _cairo_image_analyze_color (cairo_image_surface_t *image) return image->color = CAIRO_IMAGE_IS_COLOR; } -static const cairo_user_data_key_t clone_key; - cairo_image_surface_t * _cairo_image_surface_clone_subimage (cairo_surface_t *surface, const cairo_rectangle_int_t *extents) @@ -1242,9 +1240,7 @@ _cairo_image_surface_clone_subimage (cairo_surface_t *surface, if (unlikely (status)) goto error; - status = cairo_surface_set_user_data (image, &clone_key, surface, NULL); - if (unlikely (status)) - goto error; + _cairo_image_surface_set_parent (to_image_surface (image), surface); return to_image_surface (image); @@ -1252,9 +1248,3 @@ error: cairo_surface_destroy (image); return to_image_surface (_cairo_surface_create_in_error (status)); } - -cairo_bool_t -_cairo_image_surface_is_clone (cairo_image_surface_t *image) -{ - return cairo_surface_get_user_data (&image->base, &clone_key) != NULL; -} |