Wrap Node::draw_children() with rsvg_node_draw_children() and use that

... instead of the old _rsvg_node_draw_children().
parent 4762790f
......@@ -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)
......
......@@ -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) {
......
......@@ -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;
......
......@@ -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)
......
......@@ -58,9 +58,6 @@ struct _RsvgNodeSvg {
RsvgPropertyBag *atts;
};
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);
......
......@@ -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);
}
}
......@@ -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::{
......
......@@ -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);
......
......@@ -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;
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment