rsvg_filter_primitive_diffuse_lighting_set_atts(): Parse attributes with the PHF

parent 28586d0c
......@@ -5022,52 +5022,76 @@ static void
rsvg_filter_primitive_diffuse_lighting_set_atts (RsvgNode *node, gpointer impl, RsvgHandle *handle, RsvgPropertyBag atts)
{
RsvgFilterPrimitiveDiffuseLighting *filter = impl;
const char *value;
RsvgState *state;
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);
RsvgPropertyBagIter *iter;
const char *key;
RsvgAttribute attr;
const char *value;
filter_primitive_set_x_y_width_height_atts ((RsvgFilterPrimitive *) filter, atts);
if ((value = rsvg_property_bag_lookup (atts, "kernelUnitLength")))
rsvg_css_parse_number_optional_number (value, &filter->dx, &filter->dy);
iter = rsvg_property_bag_iter_begin (atts);
if ((value = rsvg_property_bag_lookup (atts, "lighting-color"))) {
RsvgCssColorSpec spec;
while (rsvg_property_bag_iter_next (iter, &key, &attr, &value)) {
switch (attr) {
case RSVG_ATTRIBUTE_IN:
g_string_assign (filter->super.in, value);
break;
spec = rsvg_css_parse_color (value, ALLOW_INHERIT_YES, ALLOW_CURRENT_COLOR_YES);
case RSVG_ATTRIBUTE_RESULT:
g_string_assign (filter->super.result, value);
break;
switch (spec.kind) {
case RSVG_CSS_COLOR_SPEC_INHERIT:
/* FIXME: we should inherit; see how stop-color is handled in rsvg-styles.c */
case RSVG_ATTRIBUTE_KERNEL_UNIT_LENGTH:
rsvg_css_parse_number_optional_number (value, &filter->dx, &filter->dy);
break;
case RSVG_CSS_COLOR_SPEC_CURRENT_COLOR:
state = rsvg_state_new ();
rsvg_state_reconstruct (state, node);
filter->lightingcolor = state->current_color;
case RSVG_ATTRIBUTE_LIGHTING_COLOR: {
RsvgCssColorSpec spec;
spec = rsvg_css_parse_color (value, ALLOW_INHERIT_YES, ALLOW_CURRENT_COLOR_YES);
switch (spec.kind) {
case RSVG_CSS_COLOR_SPEC_INHERIT:
/* FIXME: we should inherit; see how stop-color is handled in rsvg-styles.c */
break;
case RSVG_CSS_COLOR_SPEC_CURRENT_COLOR:
state = rsvg_state_new ();
rsvg_state_reconstruct (state, node);
filter->lightingcolor = state->current_color;
break;
case RSVG_CSS_COLOR_SPEC_ARGB:
filter->lightingcolor = spec.argb;
break;
case RSVG_CSS_COLOR_PARSE_ERROR:
rsvg_node_set_attribute_parse_error (node, "lighting-color", "Invalid color");
goto out;
default:
g_assert_not_reached ();
}
break;
}
case RSVG_CSS_COLOR_SPEC_ARGB:
filter->lightingcolor = spec.argb;
case RSVG_ATTRIBUTE_DIFFUSE_CONSTANT:
filter->diffuseConstant = g_ascii_strtod (value, NULL);
break;
case RSVG_CSS_COLOR_PARSE_ERROR:
rsvg_node_set_attribute_parse_error (node, "lighting-color", "Invalid color");
case RSVG_ATTRIBUTE_SURFACE_SCALE:
filter->surfaceScale = g_ascii_strtod (value, NULL);
break;
default:
g_assert_not_reached ();
break;
}
}
if ((value = rsvg_property_bag_lookup (atts, "diffuseConstant")))
filter->diffuseConstant = g_ascii_strtod (value, NULL);
if ((value = rsvg_property_bag_lookup (atts, "surfaceScale")))
filter->surfaceScale = g_ascii_strtod (value, NULL);
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