diff options
author | Federico Mena Quintero <federico@gnome.org> | 2018-02-21 15:01:29 -0600 |
---|---|---|
committer | Federico Mena Quintero <federico@gnome.org> | 2018-02-21 15:01:29 -0600 |
commit | f71ef5e0c3d5845e7fdd2f04cf14db8bf466a1e8 (patch) | |
tree | 44a6ddd3cf350bed9a004d240a5799e79b9ab21e /rsvg-filter.c | |
parent | cf5c32224219b69051b00cda1e0e368904b32f5f (diff) | |
download | librsvg-f71ef5e0c3d5845e7fdd2f04cf14db8bf466a1e8.tar.gz |
filter_primitive_set_x_y_width_height_atts(): Parse attributes with the PHF
Diffstat (limited to 'rsvg-filter.c')
-rw-r--r-- | rsvg-filter.c | 47 |
1 files changed, 32 insertions, 15 deletions
diff --git a/rsvg-filter.c b/rsvg-filter.c index 8421a8bc..964f4d2c 100644 --- a/rsvg-filter.c +++ b/rsvg-filter.c @@ -117,24 +117,41 @@ rsvg_filter_primitive_free (gpointer impl) static void filter_primitive_set_x_y_width_height_atts (RsvgFilterPrimitive *prim, RsvgPropertyBag *atts) { + RsvgPropertyBagIter *iter; + const char *key; + RsvgAttribute attr; const char *value; - if ((value = rsvg_property_bag_lookup (atts, "x"))) { - prim->x = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL); - prim->x_specified = TRUE; - } - if ((value = rsvg_property_bag_lookup (atts, "y"))) { - prim->y = rsvg_length_parse (value, LENGTH_DIR_VERTICAL); - prim->y_specified = TRUE; - } - if ((value = rsvg_property_bag_lookup (atts, "width"))) { - prim->width = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL); - prim->width_specified = TRUE; - } - if ((value = rsvg_property_bag_lookup (atts, "height"))) { - prim->height = rsvg_length_parse (value, LENGTH_DIR_VERTICAL); - prim->height_specified = TRUE; + iter = rsvg_property_bag_iter_begin (atts); + + while (rsvg_property_bag_iter_next (iter, &key, &attr, &value)) { + switch (attr) { + case RSVG_ATTRIBUTE_X: + prim->x = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL); + prim->x_specified = TRUE; + break; + + case RSVG_ATTRIBUTE_Y: + prim->y = rsvg_length_parse (value, LENGTH_DIR_VERTICAL); + prim->y_specified = TRUE; + break; + + case RSVG_ATTRIBUTE_WIDTH: + prim->width = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL); + prim->width_specified = TRUE; + break; + + case RSVG_ATTRIBUTE_HEIGHT: + prim->height = rsvg_length_parse (value, LENGTH_DIR_VERTICAL); + prim->height_specified = TRUE; + break; + + default: + break; + } } + + rsvg_property_bag_iter_end (iter); } static void |