[cairo] [PATCH 3/3] gstate: Remove unused code
Andrea Canciani
ranma42 at gmail.com
Thu Jan 20 02:16:52 PST 2011
_cairo_gstate_redirect_target asserts that this surface is NULL
immediately before destroying it. If the code is compiled with
assertions disabled and the assert would be false, it is now safer
because instead of an invalid access it will only memleak.
_cairo_gstate_get_parent_target () is not used anymore in
cairo_pop_group () and the related code can be removed.
_cairo_gstate_is_redirected () has never been used.
The comment about the clipping is misleading, because the clip is
translated as expected since fb7f7c2f27f0823d7702f960204d6e638d697624.
---
src/cairo-gstate-private.h | 6 ------
src/cairo-gstate.c | 33 ---------------------------------
2 files changed, 0 insertions(+), 39 deletions(-)
diff --git a/src/cairo-gstate-private.h b/src/cairo-gstate-private.h
index 34355be..cd417ec 100644
--- a/src/cairo-gstate-private.h
+++ b/src/cairo-gstate-private.h
@@ -90,9 +90,6 @@ _cairo_gstate_restore (cairo_gstate_t **gstate, cairo_gstate_t **freelist);
cairo_private cairo_bool_t
_cairo_gstate_is_group (cairo_gstate_t *gstate);
-cairo_private cairo_bool_t
-_cairo_gstate_is_redirected (cairo_gstate_t *gstate);
-
cairo_private cairo_status_t
_cairo_gstate_redirect_target (cairo_gstate_t *gstate, cairo_surface_t *child);
@@ -100,9 +97,6 @@ cairo_private cairo_surface_t *
_cairo_gstate_get_target (cairo_gstate_t *gstate);
cairo_private cairo_surface_t *
-_cairo_gstate_get_parent_target (cairo_gstate_t *gstate);
-
-cairo_private cairo_surface_t *
_cairo_gstate_get_original_target (cairo_gstate_t *gstate);
cairo_private cairo_clip_t *
diff --git a/src/cairo-gstate.c b/src/cairo-gstate.c
index 52d568c..7298a7f 100644
--- a/src/cairo-gstate.c
+++ b/src/cairo-gstate.c
@@ -303,10 +303,6 @@ _cairo_gstate_restore (cairo_gstate_t **gstate, cairo_gstate_t **freelist)
* Redirect @gstate rendering to a "child" target. The original
* "parent" target with which the gstate was created will not be
* affected. See _cairo_gstate_get_target().
- *
- * Unless the redirected target has the same device offsets as the
- * original #cairo_t target, the clip will be INVALID after this call,
- * and the caller should either recreate or reset the clip.
**/
cairo_status_t
_cairo_gstate_redirect_target (cairo_gstate_t *gstate, cairo_surface_t *child)
@@ -320,7 +316,6 @@ _cairo_gstate_redirect_target (cairo_gstate_t *gstate, cairo_surface_t *child)
/* Set up our new parent_target based on our current target;
* gstate->parent_target will take the ref that is held by gstate->target
*/
- cairo_surface_destroy (gstate->parent_target);
gstate->parent_target = gstate->target;
/* Now set up our new target; we overwrite gstate->target directly,
@@ -358,21 +353,6 @@ _cairo_gstate_is_group (cairo_gstate_t *gstate)
}
/**
- * _cairo_gstate_is_redirected
- * @gstate: a #cairo_gstate_t
- *
- * This space left intentionally blank.
- *
- * Return value: %TRUE if the gstate is redirected to a target
- * different than the original, %FALSE otherwise.
- **/
-cairo_bool_t
-_cairo_gstate_is_redirected (cairo_gstate_t *gstate)
-{
- return (gstate->target != gstate->original_target);
-}
-
-/**
* _cairo_gstate_get_target:
* @gstate: a #cairo_gstate_t
*
@@ -388,19 +368,6 @@ _cairo_gstate_get_target (cairo_gstate_t *gstate)
}
/**
- * _cairo_gstate_get_parent_target:
- * @gstate: a #cairo_gstate_t
- *
- * Return the parent surface of the current drawing target surface;
- * if this particular gstate isn't a redirect gstate, this will return %NULL.
- **/
-cairo_surface_t *
-_cairo_gstate_get_parent_target (cairo_gstate_t *gstate)
-{
- return gstate->parent_target;
-}
-
-/**
* _cairo_gstate_get_original_target:
* @gstate: a #cairo_gstate_t
*
--
1.7.1
More information about the cairo
mailing list