rsvg_filter_primitive_erode_set_atts(): Parse attributes with the PHF

parent 45c7d438
......@@ -3196,28 +3196,46 @@ static void
rsvg_filter_primitive_erode_set_atts (RsvgNode *node, gpointer impl, RsvgHandle *handle, RsvgPropertyBag atts)
{
RsvgFilterPrimitiveErode *filter = impl;
RsvgPropertyBagIter *iter;
const char *key;
RsvgAttribute attr;
const char *value;
if ((value = rsvg_property_bag_lookup (atts, "in")))
g_string_assign (filter->super.in, value);
if ((value = rsvg_property_bag_lookup (atts, "result")))
g_string_assign (filter->super.result, value);
filter_primitive_set_x_y_width_height_atts ((RsvgFilterPrimitive *) filter, atts);
if ((value = rsvg_property_bag_lookup (atts, "radius"))) {
if (!rsvg_css_parse_number_optional_number (value, &filter->rx, &filter->ry)) {
rsvg_node_set_attribute_parse_error (node, "radius", "expected number-optional-number");
return;
iter = rsvg_property_bag_iter_begin (atts);
while (rsvg_property_bag_iter_next (iter, &key, &attr, &value)) {
switch (attr) {
case RSVG_ATTRIBUTE_IN:
g_string_assign (filter->super.in, value);
break;
case RSVG_ATTRIBUTE_RESULT:
g_string_assign (filter->super.result, value);
break;
case RSVG_ATTRIBUTE_RADIUS:
if (!rsvg_css_parse_number_optional_number (value, &filter->rx, &filter->ry)) {
rsvg_node_set_attribute_parse_error (node, "radius", "expected number-optional-number");
goto out;
}
break;
case RSVG_ATTRIBUTE_OPERATOR:
if (!strcmp (value, "erode"))
filter->mode = 0;
else if (!strcmp (value, "dilate"))
filter->mode = 1;
break;
default:
break;
}
}
if ((value = rsvg_property_bag_lookup (atts, "operator"))) {
if (!strcmp (value, "erode"))
filter->mode = 0;
else if (!strcmp (value, "dilate"))
filter->mode = 1;
}
out:
rsvg_property_bag_iter_end (iter);
}
RsvgNode *
......
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