Dispatch creation of new nodes from an array of element names, not a chain of strcmp()

Also, the rsvg_new_SOME_NODE_TYPE () constructor functions now take the
element name.

This lets us:

* Use bsearch() on the sorted array of element names, instead of an
  unordered chain of if (strcmp (...)).  We can replace this later with
  something better like a trie.

* Port things to Rust more easily, since the constructor functions can
  dispatch on their own based on the element name.

* Avoid special cases in the way
  rsvg_new_node_component_transfer_function() and
  rsvg_new_node_light_source() are called; now they dispatch on their
  own based on the element name.
parent 58a645cc
......@@ -247,125 +247,118 @@ node_set_atts (RsvgNode * node, RsvgHandle * ctx, RsvgPropertyBag * atts)
}
}
typedef RsvgNode *(* CreateNodeFn) (const char *element_name);
typedef struct {
const char *element_name;
CreateNodeFn create_fn;
} NodeCreator;
/* Keep these sorted by element_name! */
static const NodeCreator node_creators[] = {
{ "a", rsvg_new_group }, /* treat anchors as groups for now */
{ "circle", rsvg_new_circle },
{ "clipPath", rsvg_new_clip_path },
{ "conicalGradient", rsvg_new_radial_gradient },
{ "defs", rsvg_new_defs },
{ "ellipse", rsvg_new_ellipse },
{ "feBlend", rsvg_new_filter_primitive_blend },
{ "feColorMatrix", rsvg_new_filter_primitive_color_matrix },
{ "feComponentTransfer", rsvg_new_filter_primitive_component_transfer },
{ "feComposite", rsvg_new_filter_primitive_composite },
{ "feConvolveMatrix", rsvg_new_filter_primitive_convolve_matrix },
{ "feDiffuseLighting", rsvg_new_filter_primitive_diffuse_lighting },
{ "feDisplacementMap", rsvg_new_filter_primitive_displacement_map },
{ "feDistantLight", rsvg_new_node_light_source },
{ "feFlood", rsvg_new_filter_primitive_flood },
{ "feFuncA", rsvg_new_node_component_transfer_function },
{ "feFuncB", rsvg_new_node_component_transfer_function },
{ "feFuncG", rsvg_new_node_component_transfer_function },
{ "feFuncR", rsvg_new_node_component_transfer_function },
{ "feGaussianBlur", rsvg_new_filter_primitive_gaussian_blur },
{ "feImage", rsvg_new_filter_primitive_image },
{ "feMerge", rsvg_new_filter_primitive_merge },
{ "feMergeNode", rsvg_new_filter_primitive_merge_node },
{ "feMorphology", rsvg_new_filter_primitive_erode },
{ "feOffset", rsvg_new_filter_primitive_offset },
{ "fePointLight", rsvg_new_node_light_source },
{ "feSpecularLighting", rsvg_new_filter_primitive_specular_lighting },
{ "feSpotLight", rsvg_new_node_light_source },
{ "feTile", rsvg_new_filter_primitive_tile },
{ "feTurbulence", rsvg_new_filter_primitive_turbulence },
{ "filter", rsvg_new_filter },
{ "g", rsvg_new_group },
{ "image", rsvg_new_image },
{ "line", rsvg_new_line },
{ "linearGradient", rsvg_new_linear_gradient },
{ "marker", rsvg_new_marker },
{ "mask", rsvg_new_mask },
{ "multiImage", rsvg_new_switch }, /* hack to make multiImage sort-of work */
{ "path", rsvg_new_path },
{ "pattern", rsvg_new_pattern },
{ "polygon", rsvg_new_polygon },
{ "polyline", rsvg_new_polyline },
{ "radialGradient", rsvg_new_radial_gradient },
{ "rect", rsvg_new_rect },
{ "stop", rsvg_new_stop },
{ "subImage", rsvg_new_group },
{ "subImageRef", rsvg_new_image },
{ "svg", rsvg_new_svg },
{ "switch", rsvg_new_switch },
{ "symbol", rsvg_new_symbol },
{ "text", rsvg_new_text },
{ "tref", rsvg_new_tref },
{ "tspan", rsvg_new_tspan },
{ "use", rsvg_new_use },
};
/* hack for bug 401115. whenever we encounter a node we don't understand, push it into a group.
* this will allow us to handle things like conditionals properly.
*/
static const NodeCreator default_node_creator = { NULL, rsvg_new_group };
/* Used from bsearch() */
static int
compare_node_creators_fn (const void *a, const void *b)
{
const NodeCreator *na = a;
const NodeCreator *nb = b;
return strcmp (na->element_name, nb->element_name);
}
static const NodeCreator *
get_node_creator_for_element_name (const char *name)
{
NodeCreator key;
const NodeCreator *result;
key.element_name = name;
key.create_fn = NULL;
result = bsearch (&key,
node_creators,
G_N_ELEMENTS (node_creators),
sizeof (NodeCreator),
compare_node_creators_fn);
if (result == NULL)
result = &default_node_creator;
return result;
}
static void
rsvg_standard_element_start (RsvgHandle * ctx, const char *name, RsvgPropertyBag * atts)
{
/*replace this stuff with a hash for fast reading! */
const NodeCreator *creator;
RsvgNode *newnode = NULL;
if (!strcmp (name, "g"))
newnode = rsvg_new_group ();
else if (!strcmp (name, "a")) /*treat anchors as groups for now */
newnode = rsvg_new_group ();
else if (!strcmp (name, "switch"))
newnode = rsvg_new_switch ();
else if (!strcmp (name, "defs"))
newnode = rsvg_new_defs ();
else if (!strcmp (name, "use"))
newnode = rsvg_new_use ();
else if (!strcmp (name, "path"))
newnode = rsvg_new_path ();
else if (!strcmp (name, "line"))
newnode = rsvg_new_line ();
else if (!strcmp (name, "rect"))
newnode = rsvg_new_rect ();
else if (!strcmp (name, "ellipse"))
newnode = rsvg_new_ellipse ();
else if (!strcmp (name, "circle"))
newnode = rsvg_new_circle ();
else if (!strcmp (name, "polygon"))
newnode = rsvg_new_polygon ();
else if (!strcmp (name, "polyline"))
newnode = rsvg_new_polyline ();
else if (!strcmp (name, "symbol"))
newnode = rsvg_new_symbol ();
else if (!strcmp (name, "svg"))
newnode = rsvg_new_svg ();
else if (!strcmp (name, "mask"))
newnode = rsvg_new_mask ();
else if (!strcmp (name, "clipPath"))
newnode = rsvg_new_clip_path ();
else if (!strcmp (name, "image"))
newnode = rsvg_new_image ();
else if (!strcmp (name, "marker"))
newnode = rsvg_new_marker ();
else if (!strcmp (name, "stop"))
newnode = rsvg_new_stop ();
else if (!strcmp (name, "pattern"))
newnode = rsvg_new_pattern ();
else if (!strcmp (name, "linearGradient"))
newnode = rsvg_new_linear_gradient ();
else if (!strcmp (name, "radialGradient"))
newnode = rsvg_new_radial_gradient ();
else if (!strcmp (name, "conicalGradient"))
newnode = rsvg_new_radial_gradient ();
else if (!strcmp (name, "filter"))
newnode = rsvg_new_filter ();
else if (!strcmp (name, "feBlend"))
newnode = rsvg_new_filter_primitive_blend ();
else if (!strcmp (name, "feColorMatrix"))
newnode = rsvg_new_filter_primitive_color_matrix ();
else if (!strcmp (name, "feComponentTransfer"))
newnode = rsvg_new_filter_primitive_component_transfer ();
else if (!strcmp (name, "feComposite"))
newnode = rsvg_new_filter_primitive_composite ();
else if (!strcmp (name, "feConvolveMatrix"))
newnode = rsvg_new_filter_primitive_convolve_matrix ();
else if (!strcmp (name, "feDiffuseLighting"))
newnode = rsvg_new_filter_primitive_diffuse_lighting ();
else if (!strcmp (name, "feDisplacementMap"))
newnode = rsvg_new_filter_primitive_displacement_map ();
else if (!strcmp (name, "feFlood"))
newnode = rsvg_new_filter_primitive_flood ();
else if (!strcmp (name, "feGaussianBlur"))
newnode = rsvg_new_filter_primitive_gaussian_blur ();
else if (!strcmp (name, "feImage"))
newnode = rsvg_new_filter_primitive_image ();
else if (!strcmp (name, "feMerge"))
newnode = rsvg_new_filter_primitive_merge ();
else if (!strcmp (name, "feMorphology"))
newnode = rsvg_new_filter_primitive_erode ();
else if (!strcmp (name, "feOffset"))
newnode = rsvg_new_filter_primitive_offset ();
else if (!strcmp (name, "feSpecularLighting"))
newnode = rsvg_new_filter_primitive_specular_lighting ();
else if (!strcmp (name, "feTile"))
newnode = rsvg_new_filter_primitive_tile ();
else if (!strcmp (name, "feTurbulence"))
newnode = rsvg_new_filter_primitive_turbulence ();
else if (!strcmp (name, "feMergeNode"))
newnode = rsvg_new_filter_primitive_merge_node ();
else if (!strcmp (name, "feFuncR"))
newnode = rsvg_new_node_component_transfer_function ('r'); /* See rsvg_filter_primitive_component_transfer_render() for where these values are used */
else if (!strcmp (name, "feFuncG"))
newnode = rsvg_new_node_component_transfer_function ('g');
else if (!strcmp (name, "feFuncB"))
newnode = rsvg_new_node_component_transfer_function ('b');
else if (!strcmp (name, "feFuncA"))
newnode = rsvg_new_node_component_transfer_function ('a');
else if (!strcmp (name, "feDistantLight"))
newnode = rsvg_new_node_light_source ('d');
else if (!strcmp (name, "feSpotLight"))
newnode = rsvg_new_node_light_source ('s');
else if (!strcmp (name, "fePointLight"))
newnode = rsvg_new_node_light_source ('p');
/* hack to make multiImage sort-of work */
else if (!strcmp (name, "multiImage"))
newnode = rsvg_new_switch ();
else if (!strcmp (name, "subImageRef"))
newnode = rsvg_new_image ();
else if (!strcmp (name, "subImage"))
newnode = rsvg_new_group ();
else if (!strcmp (name, "text"))
newnode = rsvg_new_text ();
else if (!strcmp (name, "tspan"))
newnode = rsvg_new_tspan ();
else if (!strcmp (name, "tref"))
newnode = rsvg_new_tref ();
else {
/* hack for bug 401115. whenever we encounter a node we don't understand, push it into a group.
this will allow us to handle things like conditionals properly. */
newnode = rsvg_new_group ();
}
creator = get_node_creator_for_element_name (name);
g_assert (creator != NULL && creator->create_fn != NULL);
newnode = creator->create_fn (name);
if (newnode) {
g_assert (RSVG_NODE_TYPE (newnode) != RSVG_NODE_TYPE_INVALID);
......
......@@ -813,7 +813,7 @@ rsvg_filter_set_atts (RsvgNode * self, RsvgHandle * ctx, RsvgPropertyBag * atts)
* Creates a blank filter and assigns default values to everything
**/
RsvgNode *
rsvg_new_filter (void)
rsvg_new_filter (const char *element_name)
{
RsvgFilter *filter;
......@@ -1045,7 +1045,7 @@ rsvg_filter_primitive_blend_set_atts (RsvgNode * node, RsvgHandle * ctx, RsvgPro
}
RsvgNode *
rsvg_new_filter_primitive_blend (void)
rsvg_new_filter_primitive_blend (const char *element_name)
{
RsvgFilterPrimitiveBlend *filter;
filter = g_new0 (RsvgFilterPrimitiveBlend, 1);
......@@ -1296,7 +1296,7 @@ rsvg_filter_primitive_convolve_matrix_set_atts (RsvgNode * self,
}
RsvgNode *
rsvg_new_filter_primitive_convolve_matrix (void)
rsvg_new_filter_primitive_convolve_matrix (const char *element_name)
{
RsvgFilterPrimitiveConvolveMatrix *filter;
filter = g_new0 (RsvgFilterPrimitiveConvolveMatrix, 1);
......@@ -1942,7 +1942,7 @@ rsvg_filter_primitive_gaussian_blur_set_atts (RsvgNode * self,
}
RsvgNode *
rsvg_new_filter_primitive_gaussian_blur (void)
rsvg_new_filter_primitive_gaussian_blur (const char *element_name)
{
RsvgFilterPrimitiveGaussianBlur *filter;
filter = g_new0 (RsvgFilterPrimitiveGaussianBlur, 1);
......@@ -2062,7 +2062,7 @@ rsvg_filter_primitive_offset_set_atts (RsvgNode * self, RsvgHandle * ctx, RsvgPr
}
RsvgNode *
rsvg_new_filter_primitive_offset (void)
rsvg_new_filter_primitive_offset (const char *element_name)
{
RsvgFilterPrimitiveOffset *filter;
filter = g_new0 (RsvgFilterPrimitiveOffset, 1);
......@@ -2149,7 +2149,7 @@ rsvg_filter_primitive_merge_set_atts (RsvgNode * self, RsvgHandle * ctx, RsvgPro
}
RsvgNode *
rsvg_new_filter_primitive_merge (void)
rsvg_new_filter_primitive_merge (const char *element_name)
{
RsvgFilterPrimitiveMerge *filter;
filter = g_new0 (RsvgFilterPrimitiveMerge, 1);
......@@ -2191,7 +2191,7 @@ rsvg_filter_primitive_merge_node_render (RsvgFilterPrimitive * self, RsvgFilterC
}
RsvgNode *
rsvg_new_filter_primitive_merge_node (void)
rsvg_new_filter_primitive_merge_node (const char *element_name)
{
RsvgFilterPrimitive *filter;
filter = g_new (RsvgFilterPrimitive, 1);
......@@ -2425,7 +2425,7 @@ rsvg_filter_primitive_color_matrix_set_atts (RsvgNode * self, RsvgHandle * ctx,
}
RsvgNode *
rsvg_new_filter_primitive_color_matrix (void)
rsvg_new_filter_primitive_color_matrix (const char *element_name)
{
RsvgFilterPrimitiveColorMatrix *filter;
filter = g_new0 (RsvgFilterPrimitiveColorMatrix, 1);
......@@ -2647,7 +2647,7 @@ rsvg_filter_primitive_component_transfer_set_atts (RsvgNode * self, RsvgHandle *
}
RsvgNode *
rsvg_new_filter_primitive_component_transfer (void)
rsvg_new_filter_primitive_component_transfer (const char *element_name)
{
RsvgFilterPrimitiveComponentTransfer *filter;
......@@ -2716,9 +2716,23 @@ rsvg_component_transfer_function_free (RsvgNode * self)
}
RsvgNode *
rsvg_new_node_component_transfer_function (char channel)
rsvg_new_node_component_transfer_function (const char *element_name)
{
RsvgNodeComponentTransferFunc *filter;
char channel;
if (strcmp (element_name, "feFuncR") == 0)
channel = 'r';
else if (strcmp (element_name, "feFuncG") == 0)
channel = 'g';
else if (strcmp (element_name, "feFuncB") == 0)
channel = 'b';
else if (strcmp (element_name, "feFuncA") == 0)
channel = 'a';
else {
g_assert_not_reached ();
channel = '\0';
}
filter = g_new0 (RsvgNodeComponentTransferFunc, 1);
_rsvg_node_init (&filter->super, RSVG_NODE_TYPE_COMPONENT_TRANFER_FUNCTION);
......@@ -2851,7 +2865,7 @@ rsvg_filter_primitive_erode_set_atts (RsvgNode * self, RsvgHandle * ctx, RsvgPro
}
RsvgNode *
rsvg_new_filter_primitive_erode (void)
rsvg_new_filter_primitive_erode (const char *element_name)
{
RsvgFilterPrimitiveErode *filter;
filter = g_new0 (RsvgFilterPrimitiveErode, 1);
......@@ -3082,7 +3096,7 @@ rsvg_filter_primitive_composite_set_atts (RsvgNode * self, RsvgHandle * ctx, Rsv
}
RsvgNode *
rsvg_new_filter_primitive_composite (void)
rsvg_new_filter_primitive_composite (const char *element_name)
{
RsvgFilterPrimitiveComposite *filter;
filter = g_new0 (RsvgFilterPrimitiveComposite, 1);
......@@ -3169,7 +3183,7 @@ rsvg_filter_primitive_flood_set_atts (RsvgNode * self, RsvgHandle * ctx, RsvgPro
}
RsvgNode *
rsvg_new_filter_primitive_flood (void)
rsvg_new_filter_primitive_flood (const char *element_name)
{
RsvgFilterPrimitive *filter;
filter = g_new0 (RsvgFilterPrimitive, 1);
......@@ -3352,7 +3366,7 @@ rsvg_filter_primitive_displacement_map_set_atts (RsvgNode * self, RsvgHandle * c
}
RsvgNode *
rsvg_new_filter_primitive_displacement_map (void)
rsvg_new_filter_primitive_displacement_map (const char *element_name)
{
RsvgFilterPrimitiveDisplacementMap *filter;
filter = g_new0 (RsvgFilterPrimitiveDisplacementMap, 1);
......@@ -3714,7 +3728,7 @@ rsvg_filter_primitive_turbulence_set_atts (RsvgNode * self, RsvgHandle * ctx,
}
RsvgNode *
rsvg_new_filter_primitive_turbulence (void)
rsvg_new_filter_primitive_turbulence (const char *element_name)
{
RsvgFilterPrimitiveTurbulence *filter;
filter = g_new0 (RsvgFilterPrimitiveTurbulence, 1);
......@@ -3931,7 +3945,7 @@ rsvg_filter_primitive_image_set_atts (RsvgNode * self, RsvgHandle * ctx, RsvgPro
}
RsvgNode *
rsvg_new_filter_primitive_image (void)
rsvg_new_filter_primitive_image (const char *element_name)
{
RsvgFilterPrimitiveImage *filter;
filter = g_new0 (RsvgFilterPrimitiveImage, 1);
......@@ -4326,20 +4340,25 @@ rsvg_node_light_source_set_atts (RsvgNode * self,
}
RsvgNode *
rsvg_new_node_light_source (char type)
rsvg_new_node_light_source (const char *element_name)
{
RsvgNodeLightSource *data;
data = g_new (RsvgNodeLightSource, 1);
_rsvg_node_init (&data->super, RSVG_NODE_TYPE_LIGHT_SOURCE);
data->super.free = _rsvg_node_free;
data->super.set_atts = rsvg_node_light_source_set_atts;
data->specularExponent = 1;
if (type == 's')
if (strcmp (element_name, "feDistantLight") == 0)
data->type = SPOTLIGHT;
else if (type == 'd')
else if (strcmp (element_name, "feSpotLight") == 0)
data->type = DISTANTLIGHT;
else
else if (strcmp (element_name, "fePointLight") == 0)
data->type = POINTLIGHT;
else
g_assert_not_reached ();
data->limitingconeAngle = 180;
return &data->super;
}
......@@ -4491,7 +4510,7 @@ rsvg_filter_primitive_diffuse_lighting_set_atts (RsvgNode * self, RsvgHandle * c
}
RsvgNode *
rsvg_new_filter_primitive_diffuse_lighting (void)
rsvg_new_filter_primitive_diffuse_lighting (const char *element_name)
{
RsvgFilterPrimitiveDiffuseLighting *filter;
filter = g_new0 (RsvgFilterPrimitiveDiffuseLighting, 1);
......@@ -4660,7 +4679,7 @@ rsvg_filter_primitive_specular_lighting_set_atts (RsvgNode * self, RsvgHandle *
RsvgNode *
rsvg_new_filter_primitive_specular_lighting (void)
rsvg_new_filter_primitive_specular_lighting (const char *element_name)
{
RsvgFilterPrimitiveSpecularLighting *filter;
filter = g_new0 (RsvgFilterPrimitiveSpecularLighting, 1);
......@@ -4764,7 +4783,7 @@ rsvg_filter_primitive_tile_set_atts (RsvgNode * self, RsvgHandle * ctx, RsvgProp
}
RsvgNode *
rsvg_new_filter_primitive_tile (void)
rsvg_new_filter_primitive_tile (const char *element_name)
{
RsvgFilterPrimitiveTile *filter;
filter = g_new0 (RsvgFilterPrimitiveTile, 1);
......
......@@ -52,45 +52,45 @@ cairo_surface_t *rsvg_filter_render (RsvgFilter *self,
char *channelmap);
G_GNUC_INTERNAL
RsvgNode *rsvg_new_filter (void);
RsvgNode *rsvg_new_filter (const char *element_name);
G_GNUC_INTERNAL
RsvgNode *rsvg_new_filter_primitive_blend (void);
RsvgNode *rsvg_new_filter_primitive_blend (const char *element_name);
G_GNUC_INTERNAL
RsvgNode *rsvg_new_filter_primitive_convolve_matrix (void);
RsvgNode *rsvg_new_filter_primitive_convolve_matrix (const char *element_name);
G_GNUC_INTERNAL
RsvgNode *rsvg_new_filter_primitive_gaussian_blur (void);
RsvgNode *rsvg_new_filter_primitive_gaussian_blur (const char *element_name);
G_GNUC_INTERNAL
RsvgNode *rsvg_new_filter_primitive_offset (void);
RsvgNode *rsvg_new_filter_primitive_offset (const char *element_name);
G_GNUC_INTERNAL
RsvgNode *rsvg_new_filter_primitive_merge (void);
RsvgNode *rsvg_new_filter_primitive_merge (const char *element_name);
G_GNUC_INTERNAL
RsvgNode *rsvg_new_filter_primitive_merge_node (void);
RsvgNode *rsvg_new_filter_primitive_merge_node (const char *element_name);
G_GNUC_INTERNAL
RsvgNode *rsvg_new_filter_primitive_color_matrix (void);
RsvgNode *rsvg_new_filter_primitive_color_matrix (const char *element_name);
G_GNUC_INTERNAL
RsvgNode *rsvg_new_filter_primitive_component_transfer (void);
RsvgNode *rsvg_new_filter_primitive_component_transfer (const char *element_name);
G_GNUC_INTERNAL
RsvgNode *rsvg_new_node_component_transfer_function (char channel);
RsvgNode *rsvg_new_node_component_transfer_function (const char *element_name);
G_GNUC_INTERNAL
RsvgNode *rsvg_new_filter_primitive_erode (void);
RsvgNode *rsvg_new_filter_primitive_erode (const char *element_name);
G_GNUC_INTERNAL
RsvgNode *rsvg_new_filter_primitive_composite (void);
RsvgNode *rsvg_new_filter_primitive_composite (const char *element_name);
G_GNUC_INTERNAL
RsvgNode *rsvg_new_filter_primitive_flood (void);
RsvgNode *rsvg_new_filter_primitive_flood (const char *element_name);
G_GNUC_INTERNAL
RsvgNode *rsvg_new_filter_primitive_displacement_map (void);
RsvgNode *rsvg_new_filter_primitive_displacement_map (const char *element_name);
G_GNUC_INTERNAL
RsvgNode *rsvg_new_filter_primitive_turbulence (void);
RsvgNode *rsvg_new_filter_primitive_turbulence (const char *element_name);
G_GNUC_INTERNAL
RsvgNode *rsvg_new_filter_primitive_image (void);
RsvgNode *rsvg_new_filter_primitive_image (const char *element_name);
G_GNUC_INTERNAL
RsvgNode *rsvg_new_filter_primitive_diffuse_lighting (void);
RsvgNode *rsvg_new_filter_primitive_diffuse_lighting (const char *element_name);
G_GNUC_INTERNAL
RsvgNode *rsvg_new_node_light_source (char type);
RsvgNode *rsvg_new_node_light_source (const char *element_name);
G_GNUC_INTERNAL
RsvgNode *rsvg_new_filter_primitive_specular_lighting (void);
RsvgNode *rsvg_new_filter_primitive_specular_lighting (const char *element_name);
G_GNUC_INTERNAL
RsvgNode *rsvg_new_filter_primitive_tile (void);
RsvgNode *rsvg_new_filter_primitive_tile (const char *element_name);
G_END_DECLS
......
......@@ -234,7 +234,7 @@ rsvg_node_image_set_atts (RsvgNode * self, RsvgHandle * ctx, RsvgPropertyBag * a
}
RsvgNode *
rsvg_new_image (void)
rsvg_new_image (const char *element_name)
{
RsvgNodeImage *image;
image = g_new (RsvgNodeImage, 1);
......
......@@ -37,7 +37,7 @@
G_BEGIN_DECLS
G_GNUC_INTERNAL
RsvgNode *rsvg_new_image (void);
RsvgNode *rsvg_new_image (const char *element_name);
typedef struct _RsvgNodeImage RsvgNodeImage;
......
......@@ -91,7 +91,7 @@ rsvg_node_marker_set_atts (RsvgNode * self, RsvgHandle * ctx, RsvgPropertyBag *
}
RsvgNode *
rsvg_new_marker (void)
rsvg_new_marker (const char *element_name)
{
RsvgMarker *marker;
marker = g_new (RsvgMarker, 1);
......
......@@ -31,7 +31,7 @@
G_BEGIN_DECLS
G_GNUC_INTERNAL
RsvgNode *rsvg_new_marker (void);
RsvgNode *rsvg_new_marker (const char *element_name);
/* In the Rust code */
G_GNUC_INTERNAL
......
......@@ -66,7 +66,7 @@ rsvg_mask_set_atts (RsvgNode * self, RsvgHandle * ctx, RsvgPropertyBag * atts)
}
RsvgNode *
rsvg_new_mask (void)
rsvg_new_mask (const char *element_name)
{
RsvgMask *mask;
......@@ -123,7 +123,7 @@ rsvg_clip_path_set_atts (RsvgNode * self, RsvgHandle * ctx, RsvgPropertyBag * at
}
RsvgNode *
rsvg_new_clip_path (void)
rsvg_new_clip_path (const char *element_name)
{
RsvgClipPath *clip_path;
......
......@@ -47,7 +47,7 @@ struct _RsvgMask {
};
G_GNUC_INTERNAL
RsvgNode *rsvg_new_mask (void);
RsvgNode *rsvg_new_mask (const char *element_name);
typedef struct _RsvgClipPath RsvgClipPath;
......@@ -57,7 +57,7 @@ struct _RsvgClipPath {
};
G_GNUC_INTERNAL
RsvgNode *rsvg_new_clip_path (void);
RsvgNode *rsvg_new_clip_path (const char *element_name);
G_END_DECLS
#endif
......@@ -224,7 +224,7 @@ rsvg_stop_set_atts (RsvgNode * self, RsvgHandle * ctx, RsvgPropertyBag * atts)
}
RsvgNode *
rsvg_new_stop (void)
rsvg_new_stop (const char *element_name)
{
RsvgGradientStop *stop = g_new (RsvgGradientStop, 1);
_rsvg_node_init (&stop->super, RSVG_NODE_TYPE_STOP);
......@@ -292,7 +292,7 @@ rsvg_linear_gradient_free (RsvgNode * node)
}
RsvgNode *
rsvg_new_linear_gradient (void)
rsvg_new_linear_gradient (const char *element_name)
{
RsvgLinearGradient *grad = NULL;
grad = g_new (RsvgLinearGradient, 1);
......@@ -375,7 +375,7 @@ rsvg_radial_gradient_free (RsvgNode * node)
}
RsvgNode *
rsvg_new_radial_gradient (void)
rsvg_new_radial_gradient (const char *element_name)
{
RsvgRadialGradient *grad = g_new (RsvgRadialGradient, 1);
......@@ -454,7 +454,7 @@ rsvg_pattern_free (RsvgNode * node)
RsvgNode *
rsvg_new_pattern (void)
rsvg_new_pattern (const char *element_name)
{
RsvgPattern *pattern = g_new (RsvgPattern, 1);
_rsvg_node_init (&pattern->super, RSVG_NODE_TYPE_PATTERN);
......
......@@ -138,13 +138,13 @@ G_GNUC_INTERNAL
void rsvg_paint_server_unref (RsvgPaintServer * ps);
G_GNUC_INTERNAL
RsvgNode *rsvg_new_linear_gradient (void);
RsvgNode *rsvg_new_linear_gradient (const char *element_name);
G_GNUC_INTERNAL
RsvgNode *rsvg_new_radial_gradient (void);
RsvgNode *rsvg_new_radial_gradient (const char *element_name);
G_GNUC_INTERNAL
RsvgNode *rsvg_new_stop (void);
RsvgNode *rsvg_new_stop (const char *element_name);
G_GNUC_INTERNAL
RsvgNode *rsvg_new_pattern (void);
RsvgNode *rsvg_new_pattern (const char *element_name);
G_GNUC_INTERNAL
void rsvg_pattern_fix_fallback (RsvgDrawingCtx * ctx,
RsvgPattern * pattern);
......
......@@ -90,7 +90,7 @@ rsvg_node_path_set_atts (RsvgNode * self, RsvgHandle * ctx, RsvgPropertyBag * at
}
RsvgNode *
rsvg_new_path (void)
rsvg_new_path (const char *element_name)
{
RsvgNodePath *path;
path = g_new (RsvgNodePath, 1);
......@@ -222,13 +222,13 @@ rsvg_new_any_poly (RsvgNodeType type)
}
RsvgNode *
rsvg_new_polygon (void)
rsvg_new_polygon (const char *element_name)
{
return rsvg_new_any_poly (RSVG_NODE_TYPE_POLYGON);
}
RsvgNode *
rsvg_new_polyline (void)
rsvg_new_polyline (const char *element_name)
{
return rsvg_new_any_poly (RSVG_NODE_TYPE_POLYLINE);
}
......@@ -288,7 +288,7 @@ _rsvg_node_line_draw (RsvgNode * overself, RsvgDrawingCtx * ctx, int dominate)
}
RsvgNode *
rsvg_new_line (void)
rsvg_new_line (const char *element_name)
{
RsvgNodeLine *line;
line = g_new (RsvgNodeLine, 1);
......@@ -478,7 +478,7 @@ _rsvg_node_rect_draw (RsvgNode * self, RsvgDrawingCtx * ctx, int dominate)
}
RsvgNode *
rsvg_new_rect (void)
rsvg_new_rect (const char *element_name)
{
RsvgNodeRect *rect;
rect = g_new (RsvgNodeRect, 1);
......@@ -567,7 +567,7 @@ _rsvg_node_circle_draw (RsvgNode * self, RsvgDrawingCtx * ctx, int dominate)
}
RsvgNode *
rsvg_new_circle (void)
rsvg_new_circle (const char *element_name)
{
RsvgNodeCircle *circle;
circle = g_new (RsvgNodeCircle, 1);
......@@ -658,7 +658,7 @@ _rsvg_node_ellipse_draw (RsvgNode * self, RsvgDrawingCtx * ctx, int dominate)
}
RsvgNode *
rsvg_new_ellipse (void)
rsvg_new_ellipse (const char *element_name)
{
RsvgNodeEllipse *ellipse;
ellipse = g_new (RsvgNodeEllipse, 1);
......
......@@ -37,19 +37,19 @@
G_BEGIN_DECLS
G_GNUC_INTERNAL
RsvgNode *rsvg_new_path (void);
RsvgNode *rsvg_new_path (const char *element_name);
G_GNUC_INTERNAL
RsvgNode *rsvg_new_polygon (void);
RsvgNode *rsvg_new_polygon (const char *element_name);
G_GNUC_INTERNAL
RsvgNode *rsvg_new_polyline (void);
RsvgNode *rsvg_new_polyline (const char *element_name);
G_GNUC_INTERNAL
RsvgNode *rsvg_new_line (void);
RsvgNode *rsvg_new_line (const char *element_name);
G_GNUC_INTERNAL
RsvgNode *rsvg_new_rect (void);
RsvgNode *rsvg_new_rect (const char *element_name);
G_GNUC_INTERNAL
RsvgNode *rsvg_new_circle (void);
RsvgNode *rsvg_new_circle (const char *element_name);
G_GNUC_INTERNAL
RsvgNode *rsvg_new_ellipse (void);
RsvgNode *rsvg_new_ellipse (const char *element_name);
G_END_DECLS
......
......@@ -132,7 +132,7 @@ rsvg_node_group_set_atts (RsvgNode * self, RsvgHandle * ctx, RsvgPropertyBag * a
}
RsvgNode *
rsvg_new_group (void)
rsvg_new_group (const char *element_name)
{
RsvgNodeGroup *group;
group = g_new (RsvgNodeGroup, 1);
......@@ -362,7 +362,7 @@ _rsvg_svg_free (RsvgNode * self)
}
RsvgNode *