[librsvg: 80/95] rsvg_filter_primitive_composite_set_atts(): Parse attributes with the PHF
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 80/95] rsvg_filter_primitive_composite_set_atts(): Parse attributes with the PHF
- Date: Thu, 22 Feb 2018 03:19:51 +0000 (UTC)
commit 554f773c423314c147ec3211f5410331a4efbbdc
Author: Federico Mena Quintero <federico gnome org>
Date: Wed Feb 21 17:19:26 2018 -0600
rsvg_filter_primitive_composite_set_atts(): Parse attributes with the PHF
rsvg-filter.c | 85 +++++++++++++++++++++++++++++++++++++++--------------------
1 file changed, 56 insertions(+), 29 deletions(-)
---
diff --git a/rsvg-filter.c b/rsvg-filter.c
index ff886309..70187581 100644
--- a/rsvg-filter.c
+++ b/rsvg-filter.c
@@ -3419,39 +3419,66 @@ static void
rsvg_filter_primitive_composite_set_atts (RsvgNode *node, gpointer impl, RsvgHandle *handle, RsvgPropertyBag
atts)
{
RsvgFilterPrimitiveComposite *filter = impl;
+ RsvgPropertyBagIter *iter;
+ const char *key;
+ RsvgAttribute attr;
const char *value;
- if ((value = rsvg_property_bag_lookup (atts, "operator"))) {
- if (!strcmp (value, "in"))
- filter->mode = COMPOSITE_MODE_IN;
- else if (!strcmp (value, "out"))
- filter->mode = COMPOSITE_MODE_OUT;
- else if (!strcmp (value, "atop"))
- filter->mode = COMPOSITE_MODE_ATOP;
- else if (!strcmp (value, "xor"))
- filter->mode = COMPOSITE_MODE_XOR;
- else if (!strcmp (value, "arithmetic"))
- filter->mode = COMPOSITE_MODE_ARITHMETIC;
- else
- filter->mode = COMPOSITE_MODE_OVER;
- }
- if ((value = rsvg_property_bag_lookup (atts, "in")))
- g_string_assign (filter->super.in, value);
- if ((value = rsvg_property_bag_lookup (atts, "in2")))
- g_string_assign (filter->in2, 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, "k1")))
- filter->k1 = g_ascii_strtod (value, NULL) * 255.;
- if ((value = rsvg_property_bag_lookup (atts, "k2")))
- filter->k2 = g_ascii_strtod (value, NULL) * 255.;
- if ((value = rsvg_property_bag_lookup (atts, "k3")))
- filter->k3 = g_ascii_strtod (value, NULL) * 255.;
- if ((value = rsvg_property_bag_lookup (atts, "k4")))
- filter->k4 = g_ascii_strtod (value, NULL) * 255.;
+ iter = rsvg_property_bag_iter_begin (atts);
+
+ while (rsvg_property_bag_iter_next (iter, &key, &attr, &value)) {
+ switch (attr) {
+ case RSVG_ATTRIBUTE_OPERATOR:
+ if (!strcmp (value, "in"))
+ filter->mode = COMPOSITE_MODE_IN;
+ else if (!strcmp (value, "out"))
+ filter->mode = COMPOSITE_MODE_OUT;
+ else if (!strcmp (value, "atop"))
+ filter->mode = COMPOSITE_MODE_ATOP;
+ else if (!strcmp (value, "xor"))
+ filter->mode = COMPOSITE_MODE_XOR;
+ else if (!strcmp (value, "arithmetic"))
+ filter->mode = COMPOSITE_MODE_ARITHMETIC;
+ else
+ filter->mode = COMPOSITE_MODE_OVER;
+ break;
+
+ case RSVG_ATTRIBUTE_IN:
+ g_string_assign (filter->super.in, value);
+ break;
+
+ case RSVG_ATTRIBUTE_IN2:
+ g_string_assign (filter->in2, value);
+ break;
+
+ case RSVG_ATTRIBUTE_RESULT:
+ g_string_assign (filter->super.result, value);
+ break;
+
+ case RSVG_ATTRIBUTE_K1:
+ filter->k1 = g_ascii_strtod (value, NULL) * 255.;
+ break;
+
+ case RSVG_ATTRIBUTE_K2:
+ filter->k2 = g_ascii_strtod (value, NULL) * 255.;
+ break;
+
+ case RSVG_ATTRIBUTE_K3:
+ filter->k3 = g_ascii_strtod (value, NULL) * 255.;
+ break;
+
+ case RSVG_ATTRIBUTE_K4:
+ filter->k4 = g_ascii_strtod (value, NULL) * 255.;
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ rsvg_property_bag_iter_end (iter);
}
RsvgNode *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]