[librsvg: 84/95] rsvg_filter_primitive_image_set_atts(): Parse attributes with the PHF



commit 154bccce5dd6be99d949df4d003625b4b6100312
Author: Federico Mena Quintero <federico gnome org>
Date:   Wed Feb 21 17:34:13 2018 -0600

    rsvg_filter_primitive_image_set_atts(): Parse attributes with the PHF

 rsvg-filter.c | 34 ++++++++++++++++++++++++++--------
 1 file changed, 26 insertions(+), 8 deletions(-)
---
diff --git a/rsvg-filter.c b/rsvg-filter.c
index 6985c936..6c64e415 100644
--- a/rsvg-filter.c
+++ b/rsvg-filter.c
@@ -4381,20 +4381,38 @@ static void
 rsvg_filter_primitive_image_set_atts (RsvgNode *node, gpointer impl, RsvgHandle *handle, RsvgPropertyBag 
atts)
 {
     RsvgFilterPrimitiveImage *filter = impl;
+    RsvgPropertyBagIter *iter;
+    const char *key;
+    RsvgAttribute attr;
     const char *value;
 
     filter->handle = handle;
 
-    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);
-    if ((value = rsvg_property_bag_lookup (atts, "xlink:href"))) {
-        filter->href = g_string_new (NULL);
-        g_string_assign (filter->href, value);
+    filter_primitive_set_x_y_width_height_atts ((RsvgFilterPrimitive *) filter, atts);
+
+    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_XLINK_HREF:
+            filter->href = g_string_new (NULL);
+            g_string_assign (filter->href, value);
+            break;
+
+        default:
+            break;
+        }
     }
 
-    filter_primitive_set_x_y_width_height_atts ((RsvgFilterPrimitive *) filter, atts);
+    rsvg_property_bag_iter_end (iter);
 }
 
 RsvgNode *


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