[librsvg: 68/95] filter_primitive_set_x_y_width_height_atts(): Parse attributes with the PHF
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 68/95] filter_primitive_set_x_y_width_height_atts(): Parse attributes with the PHF
- Date: Thu, 22 Feb 2018 03:18:51 +0000 (UTC)
commit f71ef5e0c3d5845e7fdd2f04cf14db8bf466a1e8
Author: Federico Mena Quintero <federico gnome org>
Date: Wed Feb 21 15:01:29 2018 -0600
filter_primitive_set_x_y_width_height_atts(): Parse attributes with the PHF
rsvg-filter.c | 47 ++++++++++++++++++++++++++++++++---------------
1 file 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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]