rsvg_node_light_source_set_atts(): Parse attributes with the PHF

parent 154bccce
......@@ -4787,28 +4787,61 @@ static void
rsvg_node_light_source_set_atts (RsvgNode *node, gpointer impl, RsvgHandle *handle, RsvgPropertyBag atts)
{
RsvgNodeLightSource *data = impl;
RsvgPropertyBagIter *iter;
const char *key;
RsvgAttribute attr;
const char *value;
if ((value = rsvg_property_bag_lookup (atts, "azimuth")))
data->azimuth = g_ascii_strtod (value, NULL) / 180.0 * M_PI;
if ((value = rsvg_property_bag_lookup (atts, "elevation")))
data->elevation = g_ascii_strtod (value, NULL) / 180.0 * M_PI;
if ((value = rsvg_property_bag_lookup (atts, "limitingConeAngle")))
data->limitingconeAngle = g_ascii_strtod (value, NULL) / 180.0 * M_PI;
if ((value = rsvg_property_bag_lookup (atts, "x")))
data->x = data->pointsAtX = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL);
if ((value = rsvg_property_bag_lookup (atts, "y")))
data->y = data->pointsAtX = rsvg_length_parse (value, LENGTH_DIR_VERTICAL);
if ((value = rsvg_property_bag_lookup (atts, "z")))
data->z = data->pointsAtX = rsvg_length_parse (value, LENGTH_DIR_BOTH);
if ((value = rsvg_property_bag_lookup (atts, "pointsAtX")))
data->pointsAtX = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL);
if ((value = rsvg_property_bag_lookup (atts, "pointsAtY")))
data->pointsAtY = rsvg_length_parse (value, LENGTH_DIR_VERTICAL);
if ((value = rsvg_property_bag_lookup (atts, "pointsAtZ")))
data->pointsAtZ = rsvg_length_parse (value, LENGTH_DIR_BOTH);
if ((value = rsvg_property_bag_lookup (atts, "specularExponent")))
data->specularExponent = g_ascii_strtod (value, NULL);
iter = rsvg_property_bag_iter_begin (atts);
while (rsvg_property_bag_iter_next (iter, &key, &attr, &value)) {
switch (attr) {
case RSVG_ATTRIBUTE_AZIMUTH:
data->azimuth = g_ascii_strtod (value, NULL) / 180.0 * M_PI;
break;
case RSVG_ATTRIBUTE_ELEVATION:
data->elevation = g_ascii_strtod (value, NULL) / 180.0 * M_PI;
break;
case RSVG_ATTRIBUTE_LIMITING_CONE_ANGLE:
data->limitingconeAngle = g_ascii_strtod (value, NULL) / 180.0 * M_PI;
break;
case RSVG_ATTRIBUTE_X:
data->x = data->pointsAtX = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL);
break;
case RSVG_ATTRIBUTE_Y:
data->y = data->pointsAtX = rsvg_length_parse (value, LENGTH_DIR_VERTICAL);
break;
case RSVG_ATTRIBUTE_Z:
data->z = data->pointsAtX = rsvg_length_parse (value, LENGTH_DIR_BOTH);
break;
case RSVG_ATTRIBUTE_POINTS_AT_X:
data->pointsAtX = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL);
break;
case RSVG_ATTRIBUTE_POINTS_AT_Y:
data->pointsAtY = rsvg_length_parse (value, LENGTH_DIR_VERTICAL);
break;
case RSVG_ATTRIBUTE_POINTS_AT_Z:
data->pointsAtZ = rsvg_length_parse (value, LENGTH_DIR_BOTH);
break;
case RSVG_ATTRIBUTE_SPECULAR_EXPONENT:
data->specularExponent = g_ascii_strtod (value, NULL);
break;
default:
break;
}
}
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