[librsvg] Wrap Node::draw_children() with rsvg_node_draw_children() and use that
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg] Wrap Node::draw_children() with rsvg_node_draw_children() and use that
- Date: Fri, 17 Mar 2017 02:01:12 +0000 (UTC)
commit e1dcf6dd77f020107f8eff7fb6d549e66928d65d
Author: Federico Mena Quintero <federico gnome org>
Date: Thu Mar 16 19:53:00 2017 -0600
Wrap Node::draw_children() with rsvg_node_draw_children() and use that
... instead of the old _rsvg_node_draw_children().
rsvg-cairo-clip.c | 2 +-
rsvg-cairo-draw.c | 2 +-
rsvg-private.h | 5 +++++
rsvg-structure.c | 20 ++------------------
rsvg-structure.h | 3 ---
rust/src/drawing_ctx.rs | 8 --------
rust/src/lib.rs | 1 +
rust/src/marker.rs | 3 ++-
rust/src/node.rs | 8 ++++++++
rust/src/pattern.rs | 3 ++-
10 files changed, 22 insertions(+), 33 deletions(-)
---
diff --git a/rsvg-cairo-clip.c b/rsvg-cairo-clip.c
index db82936..b66984d 100644
--- a/rsvg-cairo-clip.c
+++ b/rsvg-cairo-clip.c
@@ -168,7 +168,7 @@ rsvg_cairo_clip (RsvgDrawingCtx * ctx, RsvgNode *node_clip_path, RsvgBbox * bbox
}
rsvg_state_push (ctx);
- _rsvg_node_draw_children (node_clip_path, ctx, 0);
+ rsvg_node_draw_children (node_clip_path, ctx, 0);
rsvg_state_pop (ctx);
if (clip->units == objectBoundingBox)
diff --git a/rsvg-cairo-draw.c b/rsvg-cairo-draw.c
index 117f062..831c1c5 100644
--- a/rsvg-cairo-draw.c
+++ b/rsvg-cairo-draw.c
@@ -694,7 +694,7 @@ rsvg_cairo_generate_mask (cairo_t * cr, RsvgNode *node_mask, RsvgDrawingCtx *ctx
}
rsvg_state_push (ctx);
- _rsvg_node_draw_children (node_mask, ctx, 0);
+ rsvg_node_draw_children (node_mask, ctx, 0);
rsvg_state_pop (ctx);
if (self->contentunits == objectBoundingBox) {
diff --git a/rsvg-private.h b/rsvg-private.h
index 6bb5c6c..5bc95b7 100644
--- a/rsvg-private.h
+++ b/rsvg-private.h
@@ -410,6 +410,11 @@ typedef gboolean (* RsvgNodeForeachChildFn) (RsvgNode *node, gpointer data);
/* Implemented in rust/src/node.rs */
G_GNUC_INTERNAL
void rsvg_node_foreach_child (RsvgNode *node, RsvgNodeForeachChildFn fn, gpointer data);
+/* generic function for drawing all of the children of a particular node */
+
+/* Implemented in rust/src/node.rs */
+G_GNUC_INTERNAL
+void rsvg_node_draw_children (RsvgNode *node, RsvgDrawingCtx *ctx, int dominate);
struct _RsvgNodeChars {
GString *contents;
diff --git a/rsvg-structure.c b/rsvg-structure.c
index d902a04..c9dce1e 100644
--- a/rsvg-structure.c
+++ b/rsvg-structure.c
@@ -64,22 +64,6 @@ draw_child (RsvgNode *node, gpointer data)
return TRUE;
}
-/* generic function for drawing all of the children of a particular node */
-void
-_rsvg_node_draw_children (RsvgNode *node, RsvgDrawingCtx *ctx, int dominate)
-{
- if (dominate != -1) {
- rsvg_state_reinherit_top (ctx, rsvg_node_get_state (node), dominate);
-
- rsvg_push_discrete_layer (ctx);
- }
-
- rsvg_node_foreach_child (node, draw_child, ctx);
-
- if (dominate != -1)
- rsvg_pop_discrete_layer (ctx);
-}
-
static void
rsvg_group_set_atts (RsvgNode *node, gpointer impl, RsvgHandle *handle, RsvgPropertyBag *atts)
{
@@ -89,7 +73,7 @@ rsvg_group_set_atts (RsvgNode *node, gpointer impl, RsvgHandle *handle, RsvgProp
static void
rsvg_group_draw (RsvgNode *node, gpointer impl, RsvgDrawingCtx *ctx, int dominate)
{
- _rsvg_node_draw_children (node, ctx, dominate);
+ rsvg_node_draw_children (node, ctx, dominate);
}
static void
@@ -353,7 +337,7 @@ rsvg_node_use_draw (RsvgNode *node, gpointer impl, RsvgDrawingCtx *ctx, int domi
}
rsvg_state_push (ctx);
- _rsvg_node_draw_children (child, ctx, 1);
+ rsvg_node_draw_children (child, ctx, 1);
rsvg_state_pop (ctx);
rsvg_pop_discrete_layer (ctx);
if (symbol->vbox.active)
diff --git a/rsvg-structure.h b/rsvg-structure.h
index cce76f2..3b5bcc6 100644
--- a/rsvg-structure.h
+++ b/rsvg-structure.h
@@ -59,9 +59,6 @@ struct _RsvgNodeSvg {
};
G_GNUC_INTERNAL
-void _rsvg_node_draw_children (RsvgNode *node, RsvgDrawingCtx * ctx, int dominate);
-
-G_GNUC_INTERNAL
void _rsvg_node_svg_apply_atts (RsvgNode *node, RsvgNodeSvg *svg, RsvgHandle * ctx);
G_END_DECLS
diff --git a/rust/src/drawing_ctx.rs b/rust/src/drawing_ctx.rs
index 726cc0c..b4550aa 100644
--- a/rust/src/drawing_ctx.rs
+++ b/rust/src/drawing_ctx.rs
@@ -75,8 +75,6 @@ extern "C" {
fn rsvg_cairo_get_cairo_context (draw_ctx: *const RsvgDrawingCtx) -> *mut cairo_sys::cairo_t;
fn rsvg_cairo_set_cairo_context (draw_ctx: *const RsvgDrawingCtx, cr: *const cairo_sys::cairo_t);
-
- fn _rsvg_node_draw_children (node: *const RsvgNode, draw_ctx: *const RsvgDrawingCtx, dominate:
libc::c_int);
}
pub fn get_dpi (draw_ctx: *const RsvgDrawingCtx) -> (f64, f64) {
@@ -223,9 +221,3 @@ pub fn state_pop (draw_ctx: *const RsvgDrawingCtx) {
rsvg_state_pop (draw_ctx);
}
}
-
-pub fn node_draw_children (draw_ctx: *const RsvgDrawingCtx, c_node: *const RsvgNode, dominate: libc::c_int) {
- unsafe {
- _rsvg_node_draw_children (c_node, draw_ctx, dominate);
- }
-}
diff --git a/rust/src/lib.rs b/rust/src/lib.rs
index 4a8011c..b748b97 100644
--- a/rust/src/lib.rs
+++ b/rust/src/lib.rs
@@ -57,6 +57,7 @@ pub use node::{
rsvg_node_draw,
rsvg_node_set_attribute_parse_error,
rsvg_node_foreach_child,
+ rsvg_node_draw_children,
};
pub use path_builder::{
diff --git a/rust/src/marker.rs b/rust/src/marker.rs
index e2a2cc2..57eba6f 100644
--- a/rust/src/marker.rs
+++ b/rust/src/marker.rs
@@ -181,7 +181,8 @@ impl NodeMarker {
}
}
- drawing_ctx::node_draw_children (draw_ctx, c_node, -1); // dominate=-1 so it won't reinherit state /
push a layer
+ let marker_node: &RsvgNode = unsafe { & *c_node };
+ marker_node.draw_children (draw_ctx, -1); // dominate=-1 so it won't reinherit state / push a layer
drawing_ctx::pop_discrete_layer (draw_ctx);
diff --git a/rust/src/node.rs b/rust/src/node.rs
index 9bc8676..1be2a5e 100644
--- a/rust/src/node.rs
+++ b/rust/src/node.rs
@@ -376,6 +376,14 @@ pub extern fn rsvg_node_foreach_child (raw_node: *const RsvgNode, func: NodeFore
}
}
+#[no_mangle]
+pub extern fn rsvg_node_draw_children (raw_node: *const RsvgNode, draw_ctx: *const RsvgDrawingCtx, dominate:
i32) {
+ assert! (!raw_node.is_null ());
+ let node: &RsvgNode = unsafe { & *raw_node };
+
+ node.draw_children (draw_ctx, dominate);
+}
+
#[cfg(test)]
mod tests {
use std::rc::Rc;
diff --git a/rust/src/pattern.rs b/rust/src/pattern.rs
index f4c1b72..cc174f8 100644
--- a/rust/src/pattern.rs
+++ b/rust/src/pattern.rs
@@ -353,7 +353,8 @@ fn set_pattern_on_draw_context (pattern: &Pattern,
drawing_ctx::set_current_state_affine (draw_ctx, caffine);
// Draw everything
- drawing_ctx::node_draw_children (draw_ctx, pattern.c_node, 2);
+ let pattern_node: &RsvgNode = unsafe { & *pattern.c_node };
+ pattern_node.draw_children (draw_ctx, 2);
// Return to the original coordinate system and rendering context
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]