[librsvg] Factor out common calls in rsvg_handle_create_drawing_ctx_for_node()
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg] Factor out common calls in rsvg_handle_create_drawing_ctx_for_node()
- Date: Wed, 19 Dec 2018 00:07:56 +0000 (UTC)
commit 378c18365b4a2e73394b965da55834f9485974b6
Author: Federico Mena Quintero <federico gnome org>
Date: Tue Dec 18 17:35:50 2018 -0600
Factor out common calls in rsvg_handle_create_drawing_ctx_for_node()
librsvg/rsvg-handle.c | 39 +++++++++++++++++++++------------------
1 file changed, 21 insertions(+), 18 deletions(-)
---
diff --git a/librsvg/rsvg-handle.c b/librsvg/rsvg-handle.c
index a14a3313..2a214ced 100644
--- a/librsvg/rsvg-handle.c
+++ b/librsvg/rsvg-handle.c
@@ -990,15 +990,26 @@ rsvg_handle_get_rust (RsvgHandle *handle)
}
static RsvgDrawingCtx *
-rsvg_handle_create_drawing_ctx(RsvgHandle *handle,
- cairo_t *cr,
- RsvgDimensionData *dimensions)
+rsvg_handle_create_drawing_ctx_for_node(RsvgHandle *handle,
+ cairo_t *cr,
+ RsvgDimensionData *dimensions,
+ RsvgNode *node)
{
- return rsvg_drawing_ctx_new (handle,
- cr,
- dimensions->width, dimensions->height,
- dimensions->em, dimensions->ex,
- handle->priv->is_testing);
+ RsvgDrawingCtx *draw_ctx;
+
+ draw_ctx = rsvg_drawing_ctx_new (handle,
+ cr,
+ dimensions->width, dimensions->height,
+ dimensions->em, dimensions->ex,
+ handle->priv->is_testing);
+
+ if (node != NULL) {
+ rsvg_drawing_ctx_add_node_and_ancestors_to_stack (draw_ctx, node);
+ }
+
+ rsvg_handle_rust_cascade (handle->priv->rust_handle);
+
+ return draw_ctx;
}
static gboolean
@@ -1082,13 +1093,7 @@ rsvg_handle_render_cairo_sub (RsvgHandle * handle, cairo_t * cr, const char *id)
cairo_save (cr);
- draw = rsvg_handle_create_drawing_ctx (handle, cr, &dimensions);
-
- if (drawsub != NULL) {
- rsvg_drawing_ctx_add_node_and_ancestors_to_stack (draw, drawsub);
- }
-
- rsvg_handle_rust_cascade (handle->priv->rust_handle);
+ draw = rsvg_handle_create_drawing_ctx_for_node (handle, cr, &dimensions, drawsub);
res = rsvg_drawing_ctx_draw_node_from_stack (draw);
rsvg_drawing_ctx_free (draw);
@@ -1168,10 +1173,8 @@ get_node_geometry(RsvgHandle *handle, RsvgNode *node, RsvgRectangle *ink_rect, R
target = cairo_image_surface_create (CAIRO_FORMAT_RGB24, 1, 1);
cr = cairo_create (target);
- draw = rsvg_handle_create_drawing_ctx (handle, cr, &dimensions);
- rsvg_drawing_ctx_add_node_and_ancestors_to_stack (draw, node);
+ draw = rsvg_handle_create_drawing_ctx_for_node (handle, cr, &dimensions, node);
- rsvg_handle_rust_cascade (handle->priv->rust_handle);
/* FIXME: expose this as a RenderingError in the public API */
res = rsvg_drawing_ctx_draw_node_from_stack (draw);
if (res) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]