[librsvg/librsvg-2.40: 1/10] Extract rsvg_drawing_ctx_acquire_node_ref()



commit ba9705db63bfb6a5db487e78c22831d3ff6ce7b0
Author: Federico Mena Quintero <federico gnome org>
Date:   Tue Feb 25 18:15:22 2020 -0600

    Extract rsvg_drawing_ctx_acquire_node_ref()

 rsvg-base.c    | 18 ++++++++++++------
 rsvg-private.h |  2 ++
 2 files changed, 14 insertions(+), 6 deletions(-)
---
diff --git a/rsvg-base.c b/rsvg-base.c
index b637f93b..b040dad0 100644
--- a/rsvg-base.c
+++ b/rsvg-base.c
@@ -2166,6 +2166,17 @@ rsvg_push_discrete_layer (RsvgDrawingCtx * ctx)
     ctx->render->push_discrete_layer (ctx);
 }
 
+RsvgNode *
+rsvg_drawing_ctx_acquire_node_ref (RsvgDrawingCtx * ctx, RsvgNode *node)
+{
+  if (g_slist_find (ctx->acquired_nodes, node))
+    return NULL;
+
+  ctx->acquired_nodes = g_slist_prepend (ctx->acquired_nodes, node);
+
+  return node;
+}
+
 /*
  * rsvg_acquire_node:
  * @ctx: The drawing context in use
@@ -2190,12 +2201,7 @@ rsvg_acquire_node (RsvgDrawingCtx * ctx, const char *url)
   if (node == NULL)
     return NULL;
 
-  if (g_slist_find (ctx->acquired_nodes, node))
-    return NULL;
-
-  ctx->acquired_nodes = g_slist_prepend (ctx->acquired_nodes, node);
-
-  return node;
+  return rsvg_drawing_ctx_acquire_node_ref (ctx, node);
 }
 
 /*
diff --git a/rsvg-private.h b/rsvg-private.h
index 8c3083dc..cfb4837c 100644
--- a/rsvg-private.h
+++ b/rsvg-private.h
@@ -369,6 +369,8 @@ void rsvg_pop_discrete_layer    (RsvgDrawingCtx * ctx);
 G_GNUC_INTERNAL
 void rsvg_push_discrete_layer   (RsvgDrawingCtx * ctx);
 G_GNUC_INTERNAL
+RsvgNode *rsvg_drawing_ctx_acquire_node_ref     (RsvgDrawingCtx * ctx, RsvgNode *node);
+G_GNUC_INTERNAL
 RsvgNode *rsvg_acquire_node     (RsvgDrawingCtx * ctx, const char *url);
 G_GNUC_INTERNAL
 void rsvg_release_node          (RsvgDrawingCtx * ctx, RsvgNode *node);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]