Commit 3e09cd30 authored by Federico Mena Quintero's avatar Federico Mena Quintero

Merge branch 'pborelli/librsvg-load'

parents b313708e f13405b8
Pipeline #15305 failed with stages
in 11 minutes and 11 seconds
......@@ -81,6 +81,7 @@ RUST_SRC = \
rsvg_internals/src/color.rs \
rsvg_internals/src/cond.rs \
rsvg_internals/src/coord_units.rs \
rsvg_internals/src/defs.rs \
rsvg_internals/src/draw.rs \
rsvg_internals/src/drawing_ctx.rs \
rsvg_internals/src/filters/composite.rs \
......
......@@ -264,7 +264,7 @@ rsvg_filter_primitive_blend_set_atts (RsvgNode *node, gpointer impl, RsvgHandle
}
RsvgNode *
rsvg_new_filter_primitive_blend (const char *element_name, RsvgNode *parent, const char *id)
rsvg_new_filter_primitive_blend (const char *element_name, RsvgNode *parent, const char *id, const char *klass)
{
RsvgFilterPrimitiveBlend *filter;
......@@ -278,6 +278,7 @@ rsvg_new_filter_primitive_blend (const char *element_name, RsvgNode *parent, con
return rsvg_rust_cnode_new (RSVG_NODE_TYPE_FILTER_PRIMITIVE_BLEND,
parent,
id,
klass,
filter,
rsvg_filter_primitive_blend_set_atts,
rsvg_filter_primitive_blend_free);
......
......@@ -279,7 +279,7 @@ out:
}
RsvgNode *
rsvg_new_filter_primitive_color_matrix (const char *element_name, RsvgNode *parent, const char *id)
rsvg_new_filter_primitive_color_matrix (const char *element_name, RsvgNode *parent, const char *id, const char *klass)
{
RsvgFilterPrimitiveColorMatrix *filter;
......@@ -292,6 +292,7 @@ rsvg_new_filter_primitive_color_matrix (const char *element_name, RsvgNode *pare
return rsvg_rust_cnode_new (RSVG_NODE_TYPE_FILTER_PRIMITIVE_COLOR_MATRIX,
parent,
id,
klass,
filter,
rsvg_filter_primitive_color_matrix_set_atts,
rsvg_filter_primitive_color_matrix_free);
......
......@@ -278,7 +278,7 @@ rsvg_filter_primitive_component_transfer_set_atts (RsvgNode *node, gpointer impl
}
RsvgNode *
rsvg_new_filter_primitive_component_transfer (const char *element_name, RsvgNode *parent, const char *id)
rsvg_new_filter_primitive_component_transfer (const char *element_name, RsvgNode *parent, const char *id, const char *klass)
{
RsvgFilterPrimitiveComponentTransfer *filter;
......@@ -290,6 +290,7 @@ rsvg_new_filter_primitive_component_transfer (const char *element_name, RsvgNode
return rsvg_rust_cnode_new (RSVG_NODE_TYPE_FILTER_PRIMITIVE_COMPONENT_TRANSFER,
parent,
id,
klass,
filter,
rsvg_filter_primitive_component_transfer_set_atts,
rsvg_filter_primitive_free);
......@@ -381,7 +382,7 @@ rsvg_node_component_transfer_function_free (gpointer impl)
}
RsvgNode *
rsvg_new_node_component_transfer_function (const char *element_name, RsvgNode *parent, const char *id)
rsvg_new_node_component_transfer_function (const char *element_name, RsvgNode *parent, const char *id, const char *klass)
{
RsvgNodeComponentTransferFunc *filter;
......@@ -408,6 +409,7 @@ rsvg_new_node_component_transfer_function (const char *element_name, RsvgNode *p
return rsvg_rust_cnode_new (RSVG_NODE_TYPE_COMPONENT_TRANFER_FUNCTION,
parent,
id,
klass,
filter,
rsvg_node_component_transfer_function_set_atts,
rsvg_node_component_transfer_function_free);
......
......@@ -343,7 +343,7 @@ out:
}
RsvgNode *
rsvg_new_filter_primitive_convolve_matrix (const char *element_name, RsvgNode *parent, const char *id)
rsvg_new_filter_primitive_convolve_matrix (const char *element_name, RsvgNode *parent, const char *id, const char *klass)
{
RsvgFilterPrimitiveConvolveMatrix *filter;
......@@ -364,6 +364,7 @@ rsvg_new_filter_primitive_convolve_matrix (const char *element_name, RsvgNode *p
return rsvg_rust_cnode_new (RSVG_NODE_TYPE_FILTER_PRIMITIVE_CONVOLVE_MATRIX,
parent,
id,
klass,
filter,
rsvg_filter_primitive_convolve_matrix_set_atts,
rsvg_filter_primitive_convolve_matrix_free);
......
......@@ -196,7 +196,7 @@ rsvg_filter_primitive_diffuse_lighting_set_atts (RsvgNode *node, gpointer impl,
}
RsvgNode *
rsvg_new_filter_primitive_diffuse_lighting (const char *element_name, RsvgNode *parent, const char *id)
rsvg_new_filter_primitive_diffuse_lighting (const char *element_name, RsvgNode *parent, const char *id, const char *klass)
{
RsvgFilterPrimitiveDiffuseLighting *filter;
......@@ -212,6 +212,7 @@ rsvg_new_filter_primitive_diffuse_lighting (const char *element_name, RsvgNode *
return rsvg_rust_cnode_new (RSVG_NODE_TYPE_FILTER_PRIMITIVE_DIFFUSE_LIGHTING,
parent,
id,
klass,
filter,
rsvg_filter_primitive_diffuse_lighting_set_atts,
rsvg_filter_primitive_free);
......
......@@ -223,7 +223,7 @@ rsvg_filter_primitive_displacement_map_set_atts (RsvgNode *node, gpointer impl,
}
RsvgNode *
rsvg_new_filter_primitive_displacement_map (const char *element_name, RsvgNode *parent, const char *id)
rsvg_new_filter_primitive_displacement_map (const char *element_name, RsvgNode *parent, const char *id, const char *klass)
{
RsvgFilterPrimitiveDisplacementMap *filter;
......@@ -239,6 +239,7 @@ rsvg_new_filter_primitive_displacement_map (const char *element_name, RsvgNode *
return rsvg_rust_cnode_new (RSVG_NODE_TYPE_FILTER_PRIMITIVE_DISPLACEMENT_MAP,
parent,
id,
klass,
filter,
rsvg_filter_primitive_displacement_map_set_atts,
rsvg_filter_primitive_displacement_map_free);
......
......@@ -173,7 +173,7 @@ out:
}
RsvgNode *
rsvg_new_filter_primitive_erode (const char *element_name, RsvgNode *parent, const char *id)
rsvg_new_filter_primitive_erode (const char *element_name, RsvgNode *parent, const char *id, const char *klass)
{
RsvgFilterPrimitiveErode *filter;
......@@ -188,6 +188,7 @@ rsvg_new_filter_primitive_erode (const char *element_name, RsvgNode *parent, con
return rsvg_rust_cnode_new (RSVG_NODE_TYPE_FILTER_PRIMITIVE_ERODE,
parent,
id,
klass,
filter,
rsvg_filter_primitive_erode_set_atts,
rsvg_filter_primitive_free);
......
......@@ -108,7 +108,7 @@ rsvg_filter_primitive_flood_set_atts (RsvgNode *node, gpointer impl, RsvgHandle
}
RsvgNode *
rsvg_new_filter_primitive_flood (const char *element_name, RsvgNode *parent, const char *id)
rsvg_new_filter_primitive_flood (const char *element_name, RsvgNode *parent, const char *id, const char *klass)
{
RsvgFilterPrimitive *filter;
......@@ -120,6 +120,7 @@ rsvg_new_filter_primitive_flood (const char *element_name, RsvgNode *parent, con
return rsvg_rust_cnode_new (RSVG_NODE_TYPE_FILTER_PRIMITIVE_FLOOD,
parent,
id,
klass,
filter,
rsvg_filter_primitive_flood_set_atts,
rsvg_filter_primitive_free);
......
......@@ -681,7 +681,7 @@ out:
}
RsvgNode *
rsvg_new_filter_primitive_gaussian_blur (const char *element_name, RsvgNode *parent, const char *id)
rsvg_new_filter_primitive_gaussian_blur (const char *element_name, RsvgNode *parent, const char *id, const char *klass)
{
RsvgFilterPrimitiveGaussianBlur *filter;
......@@ -695,6 +695,7 @@ rsvg_new_filter_primitive_gaussian_blur (const char *element_name, RsvgNode *par
return rsvg_rust_cnode_new (RSVG_NODE_TYPE_FILTER_PRIMITIVE_GAUSSIAN_BLUR,
parent,
id,
klass,
filter,
rsvg_filter_primitive_gaussian_blur_set_atts,
rsvg_filter_primitive_free);
......
......@@ -253,7 +253,7 @@ rsvg_filter_primitive_image_set_atts (RsvgNode *node, gpointer impl, RsvgHandle
}
RsvgNode *
rsvg_new_filter_primitive_image (const char *element_name, RsvgNode *parent, const char *id)
rsvg_new_filter_primitive_image (const char *element_name, RsvgNode *parent, const char *id, const char *klass)
{
RsvgFilterPrimitiveImage *filter;
......@@ -266,6 +266,7 @@ rsvg_new_filter_primitive_image (const char *element_name, RsvgNode *parent, con
return rsvg_rust_cnode_new (RSVG_NODE_TYPE_FILTER_PRIMITIVE_IMAGE,
parent,
id,
klass,
filter,
rsvg_filter_primitive_image_set_atts,
rsvg_filter_primitive_image_free);
......
......@@ -446,7 +446,7 @@ find_light_source_in_children (RsvgNode *node)
}
RsvgNode *
rsvg_new_node_light_source (const char *element_name, RsvgNode *parent, const char *id)
rsvg_new_node_light_source (const char *element_name, RsvgNode *parent, const char *id, const char *klass)
{
RsvgNodeLightSource *data;
......@@ -468,6 +468,7 @@ rsvg_new_node_light_source (const char *element_name, RsvgNode *parent, const ch
return rsvg_rust_cnode_new (RSVG_NODE_TYPE_LIGHT_SOURCE,
parent,
id,
klass,
data,
rsvg_node_light_source_set_atts,
g_free);
......
......@@ -199,7 +199,7 @@ rsvg_filter_primitive_specular_lighting_set_atts (RsvgNode *node, gpointer impl,
}
RsvgNode *
rsvg_new_filter_primitive_specular_lighting (const char *element_name, RsvgNode *parent, const char *id)
rsvg_new_filter_primitive_specular_lighting (const char *element_name, RsvgNode *parent, const char *id, const char *klass)
{
RsvgFilterPrimitiveSpecularLighting *filter;
......@@ -214,6 +214,7 @@ rsvg_new_filter_primitive_specular_lighting (const char *element_name, RsvgNode
return rsvg_rust_cnode_new (RSVG_NODE_TYPE_FILTER_PRIMITIVE_SPECULAR_LIGHTING,
parent,
id,
klass,
filter,
rsvg_filter_primitive_specular_lighting_set_atts,
rsvg_filter_primitive_free);
......
......@@ -142,7 +142,7 @@ rsvg_filter_primitive_tile_set_atts (RsvgNode *node, gpointer impl, RsvgHandle *
}
RsvgNode *
rsvg_new_filter_primitive_tile (const char *element_name, RsvgNode *parent, const char *id)
rsvg_new_filter_primitive_tile (const char *element_name, RsvgNode *parent, const char *id, const char *klass)
{
RsvgFilterPrimitiveTile *filter;
......@@ -154,6 +154,7 @@ rsvg_new_filter_primitive_tile (const char *element_name, RsvgNode *parent, cons
return rsvg_rust_cnode_new (RSVG_NODE_TYPE_FILTER_PRIMITIVE_TILE,
parent,
id,
klass,
filter,
rsvg_filter_primitive_tile_set_atts,
rsvg_filter_primitive_free);
......
......@@ -407,7 +407,7 @@ out:
}
RsvgNode *
rsvg_new_filter_primitive_turbulence (const char *element_name, RsvgNode *parent, const char *id)
rsvg_new_filter_primitive_turbulence (const char *element_name, RsvgNode *parent, const char *id, const char *klass)
{
RsvgFilterPrimitiveTurbulence *filter;
......@@ -428,6 +428,7 @@ rsvg_new_filter_primitive_turbulence (const char *element_name, RsvgNode *parent
return rsvg_rust_cnode_new (RSVG_NODE_TYPE_FILTER_PRIMITIVE_TURBULENCE,
parent,
id,
klass,
filter,
rsvg_filter_primitive_turbulence_set_atts,
rsvg_filter_primitive_free);
......
......@@ -61,52 +61,40 @@ cairo_surface_t *rsvg_filter_render (RsvgNode *filter_node,
RsvgDrawingCtx *context,
char *channelmap);
/* Implemented in rust/src/filters/node.rs */
G_GNUC_INTERNAL
RsvgNode *rsvg_new_filter (const char *element_name, RsvgNode *parent);
G_GNUC_INTERNAL
RsvgNode *rsvg_new_filter_primitive_blend (const char *element_name, RsvgNode *parent, const char *id);
G_GNUC_INTERNAL
RsvgNode *rsvg_new_filter_primitive_convolve_matrix (const char *element_name, RsvgNode *parent, const char *id);
RsvgNode *rsvg_new_filter_primitive_blend (const char *element_name, RsvgNode *parent, const char *id, const char *klass);
G_GNUC_INTERNAL
RsvgNode *rsvg_new_filter_primitive_gaussian_blur (const char *element_name, RsvgNode *parent, const char *id);
/* Implemented in rust/src/filters/offset.rs */
G_GNUC_INTERNAL
RsvgNode *rsvg_new_filter_primitive_offset (const char *element_name, RsvgNode *parent, const char *id);
/* Implemented in rust/src/filters/composite.rs */
RsvgNode *rsvg_new_filter_primitive_convolve_matrix (const char *element_name, RsvgNode *parent, const char *id, const char *klass);
G_GNUC_INTERNAL
RsvgNode *rsvg_new_filter_primitive_composite (const char *element_name, RsvgNode *parent, const char *id);
RsvgNode *rsvg_new_filter_primitive_gaussian_blur (const char *element_name, RsvgNode *parent, const char *id, const char *klass);
G_GNUC_INTERNAL
RsvgNode *rsvg_new_filter_primitive_merge (const char *element_name, RsvgNode *parent, const char *id);
RsvgNode *rsvg_new_filter_primitive_merge (const char *element_name, RsvgNode *parent, const char *id, const char *klass);
G_GNUC_INTERNAL
RsvgNode *rsvg_new_filter_primitive_merge_node (const char *element_name, RsvgNode *parent, const char *id);
RsvgNode *rsvg_new_filter_primitive_merge_node (const char *element_name, RsvgNode *parent, const char *id, const char *klass);
G_GNUC_INTERNAL
RsvgNode *rsvg_new_filter_primitive_color_matrix (const char *element_name, RsvgNode *parent, const char *id);
RsvgNode *rsvg_new_filter_primitive_color_matrix (const char *element_name, RsvgNode *parent, const char *id, const char *klass);
G_GNUC_INTERNAL
RsvgNode *rsvg_new_filter_primitive_component_transfer (const char *element_name, RsvgNode *parent, const char *id);
RsvgNode *rsvg_new_filter_primitive_component_transfer (const char *element_name, RsvgNode *parent, const char *id, const char *klass);
G_GNUC_INTERNAL
RsvgNode *rsvg_new_node_component_transfer_function (const char *element_name, RsvgNode *parent, const char *id);
RsvgNode *rsvg_new_node_component_transfer_function (const char *element_name, RsvgNode *parent, const char *id, const char *klass);
G_GNUC_INTERNAL
RsvgNode *rsvg_new_filter_primitive_erode (const char *element_name, RsvgNode *parent, const char *id);
RsvgNode *rsvg_new_filter_primitive_erode (const char *element_name, RsvgNode *parent, const char *id, const char *klass);
G_GNUC_INTERNAL
RsvgNode *rsvg_new_filter_primitive_flood (const char *element_name, RsvgNode *parent, const char *id);
RsvgNode *rsvg_new_filter_primitive_flood (const char *element_name, RsvgNode *parent, const char *id, const char *klass);
G_GNUC_INTERNAL
RsvgNode *rsvg_new_filter_primitive_displacement_map (const char *element_name, RsvgNode *parent, const char *id);
RsvgNode *rsvg_new_filter_primitive_displacement_map (const char *element_name, RsvgNode *parent, const char *id, const char *klass);
G_GNUC_INTERNAL
RsvgNode *rsvg_new_filter_primitive_turbulence (const char *element_name, RsvgNode *parent, const char *id);
RsvgNode *rsvg_new_filter_primitive_turbulence (const char *element_name, RsvgNode *parent, const char *id, const char *klass);
G_GNUC_INTERNAL
RsvgNode *rsvg_new_filter_primitive_image (const char *element_name, RsvgNode *parent, const char *id);
RsvgNode *rsvg_new_filter_primitive_image (const char *element_name, RsvgNode *parent, const char *id, const char *klass);
G_GNUC_INTERNAL
RsvgNode *rsvg_new_filter_primitive_diffuse_lighting (const char *element_name, RsvgNode *parent, const char *id);
RsvgNode *rsvg_new_filter_primitive_diffuse_lighting (const char *element_name, RsvgNode *parent, const char *id, const char *klass);
G_GNUC_INTERNAL
RsvgNode *rsvg_new_node_light_source (const char *element_name, RsvgNode *parent, const char *id);
RsvgNode *rsvg_new_node_light_source (const char *element_name, RsvgNode *parent, const char *id, const char *klass);
G_GNUC_INTERNAL
RsvgNode *rsvg_new_filter_primitive_specular_lighting (const char *element_name, RsvgNode *parent, const char *id);
RsvgNode *rsvg_new_filter_primitive_specular_lighting (const char *element_name, RsvgNode *parent, const char *id, const char *klass);
G_GNUC_INTERNAL
RsvgNode *rsvg_new_filter_primitive_tile (const char *element_name, RsvgNode *parent, const char *id);
RsvgNode *rsvg_new_filter_primitive_tile (const char *element_name, RsvgNode *parent, const char *id, const char *klass);
G_END_DECLS
......
......@@ -42,6 +42,10 @@ typedef enum {
LOAD_STATE_CLOSED
} LoadState;
/* Implemented in rust/src/load.rs */
G_GNUC_INTERNAL
RsvgNode *rsvg_load_new_node (const char *element_name, RsvgNode *parent, RsvgPropertyBag *atts);
struct RsvgLoad {
RsvgHandle *handle;
gboolean unlimited_size;
......@@ -291,53 +295,12 @@ free_element_name_stack (RsvgLoad *load)
load->element_name_stack = NULL;
}
static void
get_id_and_class (RsvgPropertyBag atts,
const char **out_id,
const char **out_class)
{
RsvgPropertyBagIter *iter;
const char *key;
RsvgAttribute attr;
const char *value;
g_assert (out_id != NULL);
g_assert (out_class != NULL);
*out_id = NULL;
*out_class = NULL;
iter = rsvg_property_bag_iter_begin (atts);
while (rsvg_property_bag_iter_next (iter, &key, &attr, &value)) {
switch (attr) {
case RSVG_ATTRIBUTE_ID:
*out_id = value;
break;
case RSVG_ATTRIBUTE_CLASS:
*out_class = value;
break;
default:
break;
}
}
rsvg_property_bag_iter_end (iter);
}
static void
node_set_atts (RsvgNode *node,
RsvgHandle *handle,
const char *element_name,
const char *node_id,
const char *node_class,
RsvgPropertyBag atts)
{
if (node_id != NULL)
rsvg_defs_register_node_by_id (handle->priv->defs, node_id, node);
rsvg_node_set_atts (node, handle, atts);
/* The "svg" node is special; it will load its id/class
......@@ -345,7 +308,7 @@ node_set_atts (RsvgNode *node,
* rsvg_node_svg_apply_atts()
*/
if (rsvg_node_get_type (node) != RSVG_NODE_TYPE_SVG) {
rsvg_parse_style_attrs (handle, node, element_name, node_class, node_id, atts);
rsvg_parse_style_attrs (handle, node, element_name, atts);
}
rsvg_node_set_overriden_properties (node);
......@@ -355,13 +318,8 @@ static void
standard_element_start (RsvgLoad *load, const char *name, RsvgPropertyBag * atts)
{
RsvgNode *newnode;
const char *node_id;
const char *node_class;
gboolean supports_class_attribute;
get_id_and_class (atts, &node_id, &node_class);
newnode = rsvg_load_new_node(name, load->currentnode, node_id, &supports_class_attribute);
newnode = rsvg_load_new_node(name, load->currentnode, atts);
g_assert (newnode != NULL);
g_assert (rsvg_node_get_type (newnode) != RSVG_NODE_TYPE_INVALID);
......@@ -379,11 +337,8 @@ standard_element_start (RsvgLoad *load, const char *name, RsvgPropertyBag * atts
load->currentnode = rsvg_node_ref (newnode);
if (!supports_class_attribute) {
node_class = NULL;
}
node_set_atts (newnode, load->handle, name, node_id, node_class, atts);
rsvg_node_register_in_defs (newnode, load->handle->priv->defs);
node_set_atts (newnode, load->handle, name, atts);
newnode = rsvg_node_unref (newnode);
}
......
......@@ -282,6 +282,7 @@ G_GNUC_INTERNAL
RsvgNode *rsvg_rust_cnode_new (RsvgNodeType node_type,
RsvgNode *parent,
const char *id,
const char *klass,
gpointer impl,
CNodeSetAtts set_atts_fn,
CNodeFree free_fn) G_GNUC_WARN_UNUSED_RESULT;
......
......@@ -34,42 +34,6 @@
G_BEGIN_DECLS
/* Implemented in rust/src/load.rs */
G_GNUC_INTERNAL
RsvgNode *rsvg_load_new_node (const char *element_name, RsvgNode *parent, const char *id, gboolean *supports_class_attribute);
/* Implemented in rust/src/structure.rs */
G_GNUC_INTERNAL
RsvgNode *rsvg_node_group_new (const char *element_name, RsvgNode *parent, const char *id);
/* Implemented in rust/src/link.rs */
G_GNUC_INTERNAL
RsvgNode *rsvg_node_link_new (const char *element_name, RsvgNode *parent, const char *id);
/* Implemented in rust/src/structure.rs */
G_GNUC_INTERNAL
RsvgNode *rsvg_node_defs_new (const char *element_name, RsvgNode *parent, const char *id);
/* Implemented in rust/src/structure.rs */
G_GNUC_INTERNAL
RsvgNode *rsvg_node_switch_new (const char *element_name, RsvgNode *parent, const char *id);
/* Implemented in rust/src/structure.rs */
G_GNUC_INTERNAL
RsvgNode *rsvg_node_svg_new (const char *element_name, RsvgNode *parent, const char *id);
/* Implemented in rust/src/structure.rs */
G_GNUC_INTERNAL
RsvgNode *rsvg_node_use_new (const char *element_name, RsvgNode *parent, const char *id);
/* Implemented in rust/src/structure.rs */
G_GNUC_INTERNAL
RsvgNode *rsvg_node_symbol_new (const char *element_name, RsvgNode *parent, const char *id);
/* Implemented in rust/src/image.rs */
G_GNUC_INTERNAL
RsvgNode *rsvg_node_image_new (const char *element_name, RsvgNode *parent, const char *id);
/* Implemented in rust/src/structure.rs */
G_GNUC_INTERNAL
void rsvg_node_svg_get_size (RsvgNode *node, RsvgLength *out_width, RsvgLength *out_height);
......@@ -82,74 +46,6 @@ RsvgViewBox rsvg_node_svg_get_view_box (RsvgNode *node);
G_GNUC_INTERNAL
void rsvg_node_svg_apply_atts (RsvgNode *node, RsvgHandle *handle);
/* Implemented in rust/src/text.rs */
G_GNUC_INTERNAL
RsvgNode *rsvg_node_text_new (const char *element_name, RsvgNode *parent, const char *id);
/* Implemented in rust/src/text.rs */
G_GNUC_INTERNAL
RsvgNode *rsvg_node_tref_new (const char *element_name, RsvgNode *parent, const char *id);
/* Implemented in rust/src/text.rs */
G_GNUC_INTERNAL
RsvgNode *rsvg_node_tspan_new (const char *element_name, RsvgNode *parent, const char *id);
/* Implemented in rust/src/marker.rs */
G_GNUC_INTERNAL
RsvgNode *rsvg_node_marker_new (const char *element_name, RsvgNode *parent, const char *id);
/* Implemented in rust/src/gradient.rs */
G_GNUC_INTERNAL
RsvgNode *rsvg_node_linear_gradient_new (const char *element_name, RsvgNode *parent, const char *id);
/* Implemented in rust/src/gradient.rs */
G_GNUC_INTERNAL
RsvgNode *rsvg_node_radial_gradient_new (const char *element_name, RsvgNode *parent, const char *id);
/* Implemented in rust/src/pattern.rs */
G_GNUC_INTERNAL
RsvgNode *rsvg_node_pattern_new (const char *element_name, RsvgNode *parent, const char *id);
/* Implemented in rust/src/stop.rs */
G_GNUC_INTERNAL
RsvgNode *rsvg_node_stop_new (const char *element_name, RsvgNode *parent, const char *id);
/* Implemented in rust/src/mask.rs */
G_GNUC_INTERNAL
RsvgNode *rsvg_node_mask_new (const char *element_name, RsvgNode *node, const char *id);
/* Implemented in rust/src/clip_path.rs */
G_GNUC_INTERNAL
RsvgNode *rsvg_node_clip_path_new (const char *element_name, RsvgNode *node, const char *id);
/* Implemented in rust/src/shapes.rs */
G_GNUC_INTERNAL
RsvgNode *rsvg_node_path_new (const char *element_name, RsvgNode *parent, const char *id);
/* Implemented in rust/src/shapes.rs */
G_GNUC_INTERNAL
RsvgNode *rsvg_node_polygon_new (const char *element_name, RsvgNode *parent, const char *id);
/* Implemented in rust/src/shapes.rs */
G_GNUC_INTERNAL
RsvgNode *rsvg_node_polyline_new (const char *element_name, RsvgNode *parent, const char *id);
/* Implemented in rust/src/shapes.rs */
G_GNUC_INTERNAL
RsvgNode *rsvg_node_line_new (const char *element_name, RsvgNode *parent, const char *id);
/* Implemented in rust/src/shapes.rs */
G_GNUC_INTERNAL
RsvgNode *rsvg_node_rect_new (const char *element_name, RsvgNode *parent, const char *id);
/* Implemented in rust/src/shapes.rs */
G_GNUC_INTERNAL
RsvgNode *rsvg_node_circle_new (const char *element_name, RsvgNode *parent, const char *id);
/* Implemented in rust/src/shapes.rs */
G_GNUC_INTERNAL
RsvgNode *rsvg_node_ellipse_new (const char *element_name, RsvgNode *parent, const char *id);
G_END_DECLS
#endif /* RSVG_STRUCTURE_H */
......@@ -45,8 +45,8 @@ void rsvg_parse_cssbuffer (RsvgHandle *handle, const char *buff, size_t buflen);
/* Defined in rsvg_internals/src/state.rs */
G_GNUC_INTERNAL
void rsvg_parse_style_attrs (RsvgHandle *handle, RsvgNode *node, const char *tag,
const char *klazz, const char *id, RsvgPropertyBag * atts);
void rsvg_parse_style_attrs (RsvgHandle *handle, RsvgNode *node, const char *tag, RsvgPropertyBag * atts);
G_GNUC_INTERNAL
gboolean rsvg_lookup_apply_css_style (RsvgHandle *handle, const char *target, RsvgState * state);
......
use libc;
use std::cell::Cell;
use cairo::{self, MatrixTrait};
......@@ -7,10 +6,9 @@ use attributes::Attribute;
use coord_units::CoordUnits;
use drawing_ctx::{self, RsvgDrawingCtx};
use handle::RsvgHandle;
use node::{boxed_node_new, NodeResult, NodeTrait, NodeType, RsvgNode};
use node::{NodeResult, NodeTrait, RsvgNode};
use parsers::parse;
use property_bag::PropertyBag;
use util::utf8_cstr_opt;
coord_units!(ClipPathUnits, CoordUnits::UserSpaceOnUse);
......@@ -19,7 +17,7 @@ pub struct NodeClipPath {
}
impl NodeClipPath {
fn new() -> NodeClipPath {
pub fn new() -> NodeClipPath {
NodeClipPath {
units: Cell::new(ClipPathUnits::default()),
}
......@@ -85,17 +83,3 @@ impl NodeTrait for NodeClipPath {
Ok(())
}
}
#[no_mangle]
pub extern "C" fn rsvg_node_clip_path_new(
_: *const libc::c_char,
raw_parent: *const RsvgNode,
id: *const libc::c_char,
) -> *const RsvgNode {
boxed_node_new(
NodeType::ClipPath,
raw_parent,
unsafe { utf8_cstr_opt(id) },
Box::new(NodeClipPath::new()),
)
}
......@@ -60,6 +60,7 @@ pub extern "C" fn rsvg_rust_cnode_new(
node_type: NodeType,
raw_parent: *const RsvgNode,
id: *const libc::c_char,
class: *const libc::c_char,
c_node_impl: *const RsvgCNodeImpl,
set_atts_fn: CNodeSetAtts,
free_fn: CNodeFree,
......@@ -76,6 +77,7 @@ pub extern "C" fn rsvg_rust_cnode_new(
node_type,
node_ptr_to_weak(raw_parent),
unsafe { utf8_cstr_opt(id) },
unsafe { utf8_cstr_opt(class) },
rsvg_state_new(),
Box::new(cnode),
)))
......
use glib::translate::*;
use libc;
use node::RsvgNode;
pub enum RsvgDefs {}
#[allow(improper_ctypes)]
extern "C" {
fn rsvg_defs_register_node_by_id(
defs: *mut RsvgDefs,
id: *const libc::c_char,
node: *const RsvgNode,
);
}
pub fn register_node_by_id(
defs: *mut RsvgDefs,
id: &str,
node: &RsvgNode,
) {
unsafe {
rsvg_defs_register_node_by_id(defs, id.to_glib_none().0, node);
}
}
use std::cell::{Cell, RefCell};
use cairo::{self, ImageSurface};
use libc::{self, c_char};
use attributes::Attribute;
use error::{AttributeError, NodeError};
use handle::RsvgHandle;
use node::{boxed_node_new, NodeResult, NodeTrait, NodeType, RsvgCNodeImpl, RsvgNode};
use node::{NodeResult, NodeTrait, RsvgCNodeImpl, RsvgNode};
use parsers::{self, parse, Parse};
use property_bag::PropertyBag;
use srgb::{linearize_surface, unlinearize_surface};
use util::{clamp, utf8_cstr_opt};
use util::clamp;
use super::context::{FilterContext, FilterOutput, FilterResult};
use super::input::Input;
......@@ -29,7 +28,7 @@ enum Operator {
}
/// The `feComposite` filter primitive.
struct Composite {
pub struct Composite {
base: PrimitiveWithInput,
in2: RefCell<Option<Input>>,
operator: Cell<Operator>,
......@@ -42,7 +41,7 @@ struct Composite {
impl Composite {
/// Constructs a new `Composite` with empty properties.
#[inline]
fn new() -> Composite {
pub fn new() -> Composite {
Composite {
base: PrimitiveWithInput::new::<Self>(),
in2: RefCell::new(None),
......@@ -223,19 +222,3 @@ impl From<Operator> for cairo::Operator {
}
}
}
/// Returns a new `feComposite` node.
#[no_mangle]
pub unsafe extern "C" fn rsvg_new_filter_primitive_composite(
_element_name: *const c_char,
parent: