[librsvg: 73/95] rsvg_filter_primitive_offset_set_atts(): Parse attributes with the PHF



commit b08533c3a70bc9fcaa6de4d4b798567e7e7ef9fe
Author: Federico Mena Quintero <federico gnome org>
Date:   Wed Feb 21 16:56:55 2018 -0600

    rsvg_filter_primitive_offset_set_atts(): Parse attributes with the PHF

 rsvg-filter.c | 38 +++++++++++++++++++++++++++++---------
 1 file changed, 29 insertions(+), 9 deletions(-)
---
diff --git a/rsvg-filter.c b/rsvg-filter.c
index 843f292d..24d18910 100644
--- a/rsvg-filter.c
+++ b/rsvg-filter.c
@@ -2243,19 +2243,39 @@ static void
 rsvg_filter_primitive_offset_set_atts (RsvgNode *node, gpointer impl, RsvgHandle *handle, RsvgPropertyBag 
atts)
 {
     RsvgFilterPrimitiveOffset *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, "dx")))
-        filter->dx = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL);
-    if ((value = rsvg_property_bag_lookup (atts, "dy")))
-        filter->dy = rsvg_length_parse (value, LENGTH_DIR_VERTICAL);
+    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_DX:
+            filter->dx = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL);
+            break;
+
+        case RSVG_ATTRIBUTE_DY:
+            filter->dy = rsvg_length_parse (value, LENGTH_DIR_VERTICAL);
+            break;
+
+        default:
+            break;
+        }
+    }
+
+    rsvg_property_bag_iter_end (iter);
 }
 
 RsvgNode *


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]