diff options
author | Ross Burton <ross.burton@intel.com> | 2013-11-19 17:02:30 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-11-20 14:03:33 +0000 |
commit | 852ba6c72f2555def6896fd768e1a4dea37606aa (patch) | |
tree | 143574e43e6df660e225d9c80ecf19c4f909b3c1 | |
parent | b60666e3a9a248a23a154fe14ad6569ff0a654e8 (diff) | |
download | poky-852ba6c72f2555def6896fd768e1a4dea37606aa.tar.gz |
librsvg: upgrade to 2.40.0
Add local-m4.patch and install a local vapigen.m4 so that we can autoreconf
without needing Vala installed.
Refresh build dependencies removing stale recipes and adding libcroco as it's a mandatory dependency now.
Explicitly disable Vala, with a patch from upstream until 2.40.1.
The GTK+ 2 theme engine has been removed, delete all traces of it.
Add a patch to make GTK+ use deterministic, and a disabled PACKAGECONFIG for it.
Enable parallel make, as some testing shows that it works fine.
Drop librsvg-CVE-2011-3146, merged upstream. Drop doc_Makefile.patch, our
gtk-doc.mk isn't buggy and this isn't needed anymore.
Merge multiple -dev and -dbg packages into ${PN}-dev and -dbg, and remove the
loader module .a and .la files as they are pointless.
(From OE-Core rev: ee3e2e5ce15a3bf78c7e9d76d7bf68131f2d3ef7)
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/recipes-gnome/librsvg/librsvg-2.32.1/doc_Makefile.patch | 19 | ||||
-rw-r--r-- | meta/recipes-gnome/librsvg/librsvg-2.32.1/librsvg-CVE-2011-3146.patch | 1088 | ||||
-rw-r--r-- | meta/recipes-gnome/librsvg/librsvg/gtk-option.patch | 59 | ||||
-rw-r--r-- | meta/recipes-gnome/librsvg/librsvg/local-m4.patch | 32 | ||||
-rw-r--r-- | meta/recipes-gnome/librsvg/librsvg/vapigen.m4 | 96 | ||||
-rw-r--r-- | meta/recipes-gnome/librsvg/librsvg_2.32.1.bb | 58 | ||||
-rw-r--r-- | meta/recipes-gnome/librsvg/librsvg_2.40.0.bb | 56 |
7 files changed, 243 insertions, 1165 deletions
diff --git a/meta/recipes-gnome/librsvg/librsvg-2.32.1/doc_Makefile.patch b/meta/recipes-gnome/librsvg/librsvg-2.32.1/doc_Makefile.patch deleted file mode 100644 index 860d7a984e..0000000000 --- a/meta/recipes-gnome/librsvg/librsvg-2.32.1/doc_Makefile.patch +++ /dev/null | |||
@@ -1,19 +0,0 @@ | |||
1 | Upstream-Status: Inappropriate [configuration] | ||
2 | |||
3 | Automake complains about using += before setting with = | ||
4 | |||
5 | Signed-off-by: Saul Wold <sgw@linux.intel.com> | ||
6 | |||
7 | Index: librsvg-2.32.0/doc/Makefile.am | ||
8 | =================================================================== | ||
9 | --- librsvg-2.32.0.orig/doc/Makefile.am 2010-11-24 13:13:28.000000000 -0800 | ||
10 | +++ librsvg-2.32.0/doc/Makefile.am 2010-11-24 13:13:46.161312119 -0800 | ||
11 | @@ -133,7 +133,7 @@ | ||
12 | |||
13 | # Other files to distribute | ||
14 | # e.g. EXTRA_DIST += version.xml.in | ||
15 | -EXTRA_DIST += \ | ||
16 | +EXTRA_DIST = \ | ||
17 | version.xml.in | ||
18 | |||
19 | # Files not to distribute | ||
diff --git a/meta/recipes-gnome/librsvg/librsvg-2.32.1/librsvg-CVE-2011-3146.patch b/meta/recipes-gnome/librsvg/librsvg-2.32.1/librsvg-CVE-2011-3146.patch deleted file mode 100644 index 251f31e2f8..0000000000 --- a/meta/recipes-gnome/librsvg/librsvg-2.32.1/librsvg-CVE-2011-3146.patch +++ /dev/null | |||
@@ -1,1088 +0,0 @@ | |||
1 | librsvg: CVE-2011-3146 | ||
2 | |||
3 | Store node type separately in RsvgNode | ||
4 | |||
5 | commit 34c95743ca692ea0e44778e41a7c0a129363de84 upstream | ||
6 | |||
7 | The node name (formerly RsvgNode:type) cannot be used to infer | ||
8 | the sub-type of RsvgNode that we're dealing with, since for unknown | ||
9 | elements we put type = node-name. This lead to a (potentially exploitable) | ||
10 | crash e.g. when the element name started with "fe" which tricked | ||
11 | the old code into considering it as a RsvgFilterPrimitive. | ||
12 | http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2011-3146 | ||
13 | |||
14 | https://bugzilla.gnome.org/show_bug.cgi?id=658014 | ||
15 | --- | ||
16 | rsvg-base.c | 68 ++++++++++++++++++++++++++------------------ | ||
17 | rsvg-cairo-draw.c | 2 +- | ||
18 | rsvg-filter.c | 79 +++++++++++++++++++++++++++------------------------ | ||
19 | rsvg-filter.h | 2 +- | ||
20 | rsvg-image.c | 2 +- | ||
21 | rsvg-marker.c | 4 +- | ||
22 | rsvg-mask.c | 8 ++-- | ||
23 | rsvg-paint-server.c | 25 ++++++++-------- | ||
24 | rsvg-private.h | 60 ++++++++++++++++++++++++++++++++++++++- | ||
25 | rsvg-shapes.c | 25 ++++++++-------- | ||
26 | rsvg-shapes.h | 2 +- | ||
27 | rsvg-structure.c | 25 ++++++++-------- | ||
28 | rsvg-structure.h | 5 ++- | ||
29 | rsvg-text.c | 22 ++++++++------ | ||
30 | 14 files changed, 204 insertions(+), 125 deletions(-) | ||
31 | |||
32 | diff --git a/rsvg-base.c b/rsvg-base.c | ||
33 | index 1f5c48c..b1a2d8b 100644 | ||
34 | --- a/rsvg-base.c | ||
35 | +++ b/rsvg-base.c | ||
36 | @@ -147,7 +147,6 @@ rsvg_start_style (RsvgHandle * ctx, RsvgPropertyBag * atts) | ||
37 | static void | ||
38 | rsvg_standard_element_start (RsvgHandle * ctx, const char *name, RsvgPropertyBag * atts) | ||
39 | { | ||
40 | - | ||
41 | /*replace this stuff with a hash for fast reading! */ | ||
42 | RsvgNode *newnode = NULL; | ||
43 | if (!strcmp (name, "g")) | ||
44 | @@ -241,11 +240,11 @@ rsvg_standard_element_start (RsvgHandle * ctx, const char *name, RsvgPropertyBag | ||
45 | else if (!strcmp (name, "feFuncA")) | ||
46 | newnode = rsvg_new_node_component_transfer_function ('a'); | ||
47 | else if (!strcmp (name, "feDistantLight")) | ||
48 | - newnode = rsvg_new_filter_primitive_light_source ('d'); | ||
49 | + newnode = rsvg_new_node_light_source ('d'); | ||
50 | else if (!strcmp (name, "feSpotLight")) | ||
51 | - newnode = rsvg_new_filter_primitive_light_source ('s'); | ||
52 | + newnode = rsvg_new_node_light_source ('s'); | ||
53 | else if (!strcmp (name, "fePointLight")) | ||
54 | - newnode = rsvg_new_filter_primitive_light_source ('p'); | ||
55 | + newnode = rsvg_new_node_light_source ('p'); | ||
56 | /* hack to make multiImage sort-of work */ | ||
57 | else if (!strcmp (name, "multiImage")) | ||
58 | newnode = rsvg_new_switch (); | ||
59 | @@ -259,21 +258,22 @@ rsvg_standard_element_start (RsvgHandle * ctx, const char *name, RsvgPropertyBag | ||
60 | newnode = rsvg_new_tspan (); | ||
61 | else if (!strcmp (name, "tref")) | ||
62 | newnode = rsvg_new_tref (); | ||
63 | - else { | ||
64 | + else { | ||
65 | /* hack for bug 401115. whenever we encounter a node we don't understand, push it into a group. | ||
66 | this will allow us to handle things like conditionals properly. */ | ||
67 | newnode = rsvg_new_group (); | ||
68 | } | ||
69 | |||
70 | if (newnode) { | ||
71 | - newnode->type = g_string_new (name); | ||
72 | + g_assert (RSVG_NODE_TYPE (newnode) != RSVG_NODE_TYPE_INVALID); | ||
73 | + newnode->name = (char *) name; /* libxml will keep this while parsing */ | ||
74 | newnode->parent = ctx->priv->currentnode; | ||
75 | rsvg_node_set_atts (newnode, ctx, atts); | ||
76 | rsvg_defs_register_memory (ctx->priv->defs, newnode); | ||
77 | if (ctx->priv->currentnode) { | ||
78 | rsvg_node_group_pack (ctx->priv->currentnode, newnode); | ||
79 | ctx->priv->currentnode = newnode; | ||
80 | - } else if (!strcmp (name, "svg")) { | ||
81 | + } else if (RSVG_NODE_TYPE (newnode) == RSVG_NODE_TYPE_SVG) { | ||
82 | ctx->priv->treebase = newnode; | ||
83 | ctx->priv->currentnode = newnode; | ||
84 | } | ||
85 | @@ -689,10 +689,11 @@ rsvg_end_element (void *data, const xmlChar * name) | ||
86 | ctx->priv->handler = NULL; | ||
87 | } | ||
88 | |||
89 | - if (ctx->priv->currentnode | ||
90 | - && !strcmp ((const char *) name, ctx->priv->currentnode->type->str)) | ||
91 | - rsvg_pop_def_group (ctx); | ||
92 | + if (ctx->priv->currentnode && | ||
93 | + !strcmp ((const char *) name, ctx->priv->currentnode->name)) | ||
94 | + rsvg_pop_def_group (ctx); | ||
95 | |||
96 | + /* FIXMEchpe: shouldn't this check that currentnode == treebase or sth like that? */ | ||
97 | if (ctx->priv->treebase && !strcmp ((const char *)name, "svg")) | ||
98 | _rsvg_node_svg_apply_atts ((RsvgNodeSvg *)ctx->priv->treebase, ctx); | ||
99 | } | ||
100 | @@ -706,6 +707,30 @@ _rsvg_node_chars_free (RsvgNode * node) | ||
101 | _rsvg_node_free (node); | ||
102 | } | ||
103 | |||
104 | +static RsvgNodeChars * | ||
105 | +rsvg_new_node_chars (const char *text, | ||
106 | + int len) | ||
107 | +{ | ||
108 | + RsvgNodeChars *self; | ||
109 | + | ||
110 | + self = g_new (RsvgNodeChars, 1); | ||
111 | + _rsvg_node_init (&self->super, RSVG_NODE_TYPE_CHARS); | ||
112 | + | ||
113 | + if (!g_utf8_validate (text, len, NULL)) { | ||
114 | + char *utf8; | ||
115 | + utf8 = rsvg_make_valid_utf8 (text, len); | ||
116 | + self->contents = g_string_new (utf8); | ||
117 | + g_free (utf8); | ||
118 | + } else { | ||
119 | + self->contents = g_string_new_len (text, len); | ||
120 | + } | ||
121 | + | ||
122 | + self->super.free = _rsvg_node_chars_free; | ||
123 | + self->super.state->cond_true = FALSE; | ||
124 | + | ||
125 | + return self; | ||
126 | +} | ||
127 | + | ||
128 | static void | ||
129 | rsvg_characters_impl (RsvgHandle * ctx, const xmlChar * ch, int len) | ||
130 | { | ||
131 | @@ -715,8 +740,9 @@ rsvg_characters_impl (RsvgHandle * ctx, const xmlChar * ch, int len) | ||
132 | return; | ||
133 | |||
134 | if (ctx->priv->currentnode) { | ||
135 | - if (!strcmp ("tspan", ctx->priv->currentnode->type->str) || | ||
136 | - !strcmp ("text", ctx->priv->currentnode->type->str)) { | ||
137 | + RsvgNodeType type = RSVG_NODE_TYPE (ctx->priv->currentnode); | ||
138 | + if (type == RSVG_NODE_TYPE_TSPAN || | ||
139 | + type == RSVG_NODE_TYPE_TEXT) { | ||
140 | guint i; | ||
141 | |||
142 | /* find the last CHARS node in the text or tspan node, so that we | ||
143 | @@ -724,7 +750,7 @@ rsvg_characters_impl (RsvgHandle * ctx, const xmlChar * ch, int len) | ||
144 | self = NULL; | ||
145 | for (i = 0; i < ctx->priv->currentnode->children->len; i++) { | ||
146 | RsvgNode *node = g_ptr_array_index (ctx->priv->currentnode->children, i); | ||
147 | - if (!strcmp (node->type->str, "RSVG_NODE_CHARS")) { | ||
148 | + if (RSVG_NODE_TYPE (node) == RSVG_NODE_TYPE_CHARS) { | ||
149 | self = (RsvgNodeChars*)node; | ||
150 | } | ||
151 | } | ||
152 | @@ -744,21 +770,7 @@ rsvg_characters_impl (RsvgHandle * ctx, const xmlChar * ch, int len) | ||
153 | } | ||
154 | } | ||
155 | |||
156 | - self = g_new (RsvgNodeChars, 1); | ||
157 | - _rsvg_node_init (&self->super); | ||
158 | - | ||
159 | - if (!g_utf8_validate ((char *) ch, len, NULL)) { | ||
160 | - char *utf8; | ||
161 | - utf8 = rsvg_make_valid_utf8 ((char *) ch, len); | ||
162 | - self->contents = g_string_new (utf8); | ||
163 | - g_free (utf8); | ||
164 | - } else { | ||
165 | - self->contents = g_string_new_len ((char *) ch, len); | ||
166 | - } | ||
167 | - | ||
168 | - self->super.type = g_string_new ("RSVG_NODE_CHARS"); | ||
169 | - self->super.free = _rsvg_node_chars_free; | ||
170 | - self->super.state->cond_true = FALSE; | ||
171 | + self = rsvg_new_node_chars ((char *) ch, len); | ||
172 | |||
173 | rsvg_defs_register_memory (ctx->priv->defs, (RsvgNode *) self); | ||
174 | if (ctx->priv->currentnode) | ||
175 | diff --git a/rsvg-cairo-draw.c b/rsvg-cairo-draw.c | ||
176 | index 0b74e22..c01cd17 100644 | ||
177 | --- a/rsvg-cairo-draw.c | ||
178 | +++ b/rsvg-cairo-draw.c | ||
179 | @@ -147,7 +147,7 @@ _pattern_add_rsvg_color_stops (cairo_pattern_t * pattern, | ||
180 | |||
181 | for (i = 0; i < stops->len; i++) { | ||
182 | node = (RsvgNode *) g_ptr_array_index (stops, i); | ||
183 | - if (strcmp (node->type->str, "stop")) | ||
184 | + if (RSVG_NODE_TYPE (node) != RSVG_NODE_TYPE_STOP) | ||
185 | continue; | ||
186 | stop = (RsvgGradientStop *) node; | ||
187 | rgba = stop->rgba; | ||
188 | diff --git a/rsvg-filter.c b/rsvg-filter.c | ||
189 | index e65be41..ce96c4f 100644 | ||
190 | --- a/rsvg-filter.c | ||
191 | +++ b/rsvg-filter.c | ||
192 | @@ -495,7 +495,7 @@ rsvg_filter_render (RsvgFilter * self, GdkPixbuf * source, | ||
193 | |||
194 | for (i = 0; i < self->super.children->len; i++) { | ||
195 | current = g_ptr_array_index (self->super.children, i); | ||
196 | - if (!strncmp (current->super.type->str, "fe", 2)) | ||
197 | + if (RSVG_NODE_IS_FILTER_PRIMITIVE (¤t->super)) | ||
198 | rsvg_filter_primitive_render (current, ctx); | ||
199 | } | ||
200 | |||
201 | @@ -703,7 +703,7 @@ rsvg_filter_parse (const RsvgDefs * defs, const char *str) | ||
202 | val = rsvg_defs_lookup (defs, name); | ||
203 | g_free (name); | ||
204 | |||
205 | - if (val && (!strcmp (val->type->str, "filter"))) | ||
206 | + if (val && RSVG_NODE_TYPE (val) == RSVG_NODE_TYPE_FILTER) | ||
207 | return (RsvgFilter *) val; | ||
208 | } | ||
209 | return NULL; | ||
210 | @@ -754,7 +754,7 @@ rsvg_new_filter (void) | ||
211 | RsvgFilter *filter; | ||
212 | |||
213 | filter = g_new (RsvgFilter, 1); | ||
214 | - _rsvg_node_init (&filter->super); | ||
215 | + _rsvg_node_init (&filter->super, RSVG_NODE_TYPE_FILTER); | ||
216 | filter->filterunits = objectBoundingBox; | ||
217 | filter->primitiveunits = userSpaceOnUse; | ||
218 | filter->x = _rsvg_css_parse_length ("-10%"); | ||
219 | @@ -978,7 +978,7 @@ rsvg_new_filter_primitive_blend (void) | ||
220 | { | ||
221 | RsvgFilterPrimitiveBlend *filter; | ||
222 | filter = g_new (RsvgFilterPrimitiveBlend, 1); | ||
223 | - _rsvg_node_init (&filter->super.super); | ||
224 | + _rsvg_node_init (&filter->super.super, RSVG_NODE_TYPE_FILTER_PRIMITIVE_BLEND); | ||
225 | filter->mode = normal; | ||
226 | filter->super.in = g_string_new ("none"); | ||
227 | filter->in2 = g_string_new ("none"); | ||
228 | @@ -1230,7 +1230,7 @@ rsvg_new_filter_primitive_convolve_matrix (void) | ||
229 | { | ||
230 | RsvgFilterPrimitiveConvolveMatrix *filter; | ||
231 | filter = g_new (RsvgFilterPrimitiveConvolveMatrix, 1); | ||
232 | - _rsvg_node_init (&filter->super.super); | ||
233 | + _rsvg_node_init (&filter->super.super, RSVG_NODE_TYPE_FILTER_PRIMITIVE_CONVOLVE_MATRIX); | ||
234 | filter->super.in = g_string_new ("none"); | ||
235 | filter->super.result = g_string_new ("none"); | ||
236 | filter->super.x.factor = filter->super.y.factor = filter->super.width.factor = | ||
237 | @@ -1471,7 +1471,7 @@ rsvg_new_filter_primitive_gaussian_blur (void) | ||
238 | { | ||
239 | RsvgFilterPrimitiveGaussianBlur *filter; | ||
240 | filter = g_new (RsvgFilterPrimitiveGaussianBlur, 1); | ||
241 | - _rsvg_node_init (&filter->super.super); | ||
242 | + _rsvg_node_init (&filter->super.super, RSVG_NODE_TYPE_FILTER_PRIMITIVE_GAUSSIAN_BLUR); | ||
243 | filter->super.in = g_string_new ("none"); | ||
244 | filter->super.result = g_string_new ("none"); | ||
245 | filter->super.x.factor = filter->super.y.factor = filter->super.width.factor = | ||
246 | @@ -1607,7 +1607,7 @@ rsvg_new_filter_primitive_offset (void) | ||
247 | { | ||
248 | RsvgFilterPrimitiveOffset *filter; | ||
249 | filter = g_new (RsvgFilterPrimitiveOffset, 1); | ||
250 | - _rsvg_node_init (&filter->super.super); | ||
251 | + _rsvg_node_init (&filter->super.super, RSVG_NODE_TYPE_FILTER_PRIMITIVE_OFFSET); | ||
252 | filter->super.in = g_string_new ("none"); | ||
253 | filter->super.result = g_string_new ("none"); | ||
254 | filter->super.x.factor = filter->super.y.factor = filter->super.width.factor = | ||
255 | @@ -1648,7 +1648,7 @@ rsvg_filter_primitive_merge_render (RsvgFilterPrimitive * self, RsvgFilterContex | ||
256 | for (i = 0; i < upself->super.super.children->len; i++) { | ||
257 | RsvgFilterPrimitive *mn; | ||
258 | mn = g_ptr_array_index (upself->super.super.children, i); | ||
259 | - if (strcmp (mn->super.type->str, "feMergeNode")) | ||
260 | + if (RSVG_NODE_TYPE (&mn->super) != RSVG_NODE_TYPE_FILTER_PRIMITIVE_MERGE_NODE) | ||
261 | continue; | ||
262 | in = rsvg_filter_get_in (mn->in, ctx); | ||
263 | rsvg_alpha_blt (in, boundarys.x0, boundarys.y0, boundarys.x1 - boundarys.x0, | ||
264 | @@ -1701,7 +1701,7 @@ rsvg_new_filter_primitive_merge (void) | ||
265 | { | ||
266 | RsvgFilterPrimitiveMerge *filter; | ||
267 | filter = g_new (RsvgFilterPrimitiveMerge, 1); | ||
268 | - _rsvg_node_init (&filter->super.super); | ||
269 | + _rsvg_node_init (&filter->super.super, RSVG_NODE_TYPE_FILTER_PRIMITIVE_MERGE); | ||
270 | filter->super.result = g_string_new ("none"); | ||
271 | filter->super.x.factor = filter->super.y.factor = filter->super.width.factor = | ||
272 | filter->super.height.factor = 'n'; | ||
273 | @@ -1744,7 +1744,7 @@ rsvg_new_filter_primitive_merge_node (void) | ||
274 | { | ||
275 | RsvgFilterPrimitive *filter; | ||
276 | filter = g_new (RsvgFilterPrimitive, 1); | ||
277 | - _rsvg_node_init (&filter->super); | ||
278 | + _rsvg_node_init (&filter->super, RSVG_NODE_TYPE_FILTER_PRIMITIVE_MERGE_NODE); | ||
279 | filter->in = g_string_new ("none"); | ||
280 | filter->super.free = rsvg_filter_primitive_merge_node_free; | ||
281 | filter->render = &rsvg_filter_primitive_merge_node_render; | ||
282 | @@ -1978,7 +1978,7 @@ rsvg_new_filter_primitive_colour_matrix (void) | ||
283 | { | ||
284 | RsvgFilterPrimitiveColourMatrix *filter; | ||
285 | filter = g_new (RsvgFilterPrimitiveColourMatrix, 1); | ||
286 | - _rsvg_node_init (&filter->super.super); | ||
287 | + _rsvg_node_init (&filter->super.super, RSVG_NODE_TYPE_FILTER_PRIMITIVE_COLOUR_MATRIX); | ||
288 | filter->super.in = g_string_new ("none"); | ||
289 | filter->super.result = g_string_new ("none"); | ||
290 | filter->super.x.factor = filter->super.y.factor = filter->super.width.factor = | ||
291 | @@ -2010,8 +2010,9 @@ struct _RsvgNodeComponentTransferFunc { | ||
292 | gint slope; | ||
293 | gint intercept; | ||
294 | gint amplitude; | ||
295 | - gdouble exponent; | ||
296 | gint offset; | ||
297 | + gdouble exponent; | ||
298 | + char channel; | ||
299 | }; | ||
300 | |||
301 | struct _RsvgFilterPrimitiveComponentTransfer { | ||
302 | @@ -2107,15 +2108,18 @@ rsvg_filter_primitive_component_transfer_render (RsvgFilterPrimitive * | ||
303 | for (c = 0; c < 4; c++) { | ||
304 | char channel = "RGBA"[c]; | ||
305 | for (i = 0; i < self->super.children->len; i++) { | ||
306 | - RsvgNodeComponentTransferFunc *temp; | ||
307 | - temp = (RsvgNodeComponentTransferFunc *) | ||
308 | - g_ptr_array_index (self->super.children, i); | ||
309 | - if (!strncmp (temp->super.type->str, "feFunc", 6)) | ||
310 | - if (temp->super.type->str[6] == channel) { | ||
311 | + RsvgNode *child_node; | ||
312 | + | ||
313 | + child_node = (RsvgNode *) g_ptr_array_index (self->super.children, i); | ||
314 | + if (RSVG_NODE_TYPE (child_node) == RSVG_NODE_TYPE_FILTER_PRIMITIVE_COMPONENT_TRANSFER) { | ||
315 | + RsvgNodeComponentTransferFunc *temp = (RsvgNodeComponentTransferFunc *) child_node; | ||
316 | + | ||
317 | + if (temp->channel == channel) { | ||
318 | functions[ctx->channelmap[c]] = temp->function; | ||
319 | channels[ctx->channelmap[c]] = temp; | ||
320 | break; | ||
321 | } | ||
322 | + } | ||
323 | } | ||
324 | if (i == self->super.children->len) | ||
325 | functions[ctx->channelmap[c]] = identity_component_transfer_func; | ||
326 | @@ -2198,7 +2202,7 @@ rsvg_new_filter_primitive_component_transfer (void) | ||
327 | RsvgFilterPrimitiveComponentTransfer *filter; | ||
328 | |||
329 | filter = g_new (RsvgFilterPrimitiveComponentTransfer, 1); | ||
330 | - _rsvg_node_init (&filter->super.super); | ||
331 | + _rsvg_node_init (&filter->super.super, RSVG_NODE_TYPE_FILTER_PRIMITIVE_COMPONENT_TRANSFER); | ||
332 | filter->super.result = g_string_new ("none"); | ||
333 | filter->super.in = g_string_new ("none"); | ||
334 | filter->super.x.factor = filter->super.y.factor = filter->super.width.factor = | ||
335 | @@ -2272,7 +2276,7 @@ rsvg_new_node_component_transfer_function (char channel) | ||
336 | RsvgNodeComponentTransferFunc *filter; | ||
337 | |||
338 | filter = g_new (RsvgNodeComponentTransferFunc, 1); | ||
339 | - _rsvg_node_init (&filter->super); | ||
340 | + _rsvg_node_init (&filter->super, RSVG_NODE_TYPE_COMPONENT_TRANFER_FUNCTION); | ||
341 | filter->super.free = rsvg_component_transfer_function_free; | ||
342 | filter->super.set_atts = rsvg_node_component_transfer_function_set_atts; | ||
343 | filter->function = identity_component_transfer_func; | ||
344 | @@ -2414,7 +2418,7 @@ rsvg_new_filter_primitive_erode (void) | ||
345 | { | ||
346 | RsvgFilterPrimitiveErode *filter; | ||
347 | filter = g_new (RsvgFilterPrimitiveErode, 1); | ||
348 | - _rsvg_node_init (&filter->super.super); | ||
349 | + _rsvg_node_init (&filter->super.super, RSVG_NODE_TYPE_FILTER_PRIMITIVE_ERODE); | ||
350 | filter->super.in = g_string_new ("none"); | ||
351 | filter->super.result = g_string_new ("none"); | ||
352 | filter->super.x.factor = filter->super.y.factor = filter->super.width.factor = | ||
353 | @@ -2639,7 +2643,7 @@ rsvg_new_filter_primitive_composite (void) | ||
354 | { | ||
355 | RsvgFilterPrimitiveComposite *filter; | ||
356 | filter = g_new (RsvgFilterPrimitiveComposite, 1); | ||
357 | - _rsvg_node_init (&filter->super.super); | ||
358 | + _rsvg_node_init (&filter->super.super, RSVG_NODE_TYPE_FILTER_PRIMITIVE_COMPOSITE); | ||
359 | filter->mode = COMPOSITE_MODE_OVER; | ||
360 | filter->super.in = g_string_new ("none"); | ||
361 | filter->in2 = g_string_new ("none"); | ||
362 | @@ -2744,7 +2748,7 @@ rsvg_new_filter_primitive_flood (void) | ||
363 | { | ||
364 | RsvgFilterPrimitive *filter; | ||
365 | filter = g_new (RsvgFilterPrimitive, 1); | ||
366 | - _rsvg_node_init (&filter->super); | ||
367 | + _rsvg_node_init (&filter->super, RSVG_NODE_TYPE_FILTER_PRIMITIVE_FLOOD); | ||
368 | filter->in = g_string_new ("none"); | ||
369 | filter->result = g_string_new ("none"); | ||
370 | filter->x.factor = filter->y.factor = filter->width.factor = filter->height.factor = 'n'; | ||
371 | @@ -2920,7 +2924,7 @@ rsvg_new_filter_primitive_displacement_map (void) | ||
372 | { | ||
373 | RsvgFilterPrimitiveDisplacementMap *filter; | ||
374 | filter = g_new (RsvgFilterPrimitiveDisplacementMap, 1); | ||
375 | - _rsvg_node_init (&filter->super.super); | ||
376 | + _rsvg_node_init (&filter->super.super, RSVG_NODE_TYPE_FILTER_PRIMITIVE_DISPLACEMENT_MAP); | ||
377 | filter->super.in = g_string_new ("none"); | ||
378 | filter->in2 = g_string_new ("none"); | ||
379 | filter->super.result = g_string_new ("none"); | ||
380 | @@ -3291,7 +3295,7 @@ rsvg_new_filter_primitive_turbulence (void) | ||
381 | { | ||
382 | RsvgFilterPrimitiveTurbulence *filter; | ||
383 | filter = g_new (RsvgFilterPrimitiveTurbulence, 1); | ||
384 | - _rsvg_node_init (&filter->super.super); | ||
385 | + _rsvg_node_init (&filter->super.super, RSVG_NODE_TYPE_FILTER_PRIMITIVE_TURBULENCE); | ||
386 | filter->super.in = g_string_new ("none"); | ||
387 | filter->super.result = g_string_new ("none"); | ||
388 | filter->super.x.factor = filter->super.y.factor = filter->super.width.factor = | ||
389 | @@ -3510,7 +3514,7 @@ rsvg_new_filter_primitive_image (void) | ||
390 | { | ||
391 | RsvgFilterPrimitiveImage *filter; | ||
392 | filter = g_new (RsvgFilterPrimitiveImage, 1); | ||
393 | - _rsvg_node_init (&filter->super.super); | ||
394 | + _rsvg_node_init (&filter->super.super, RSVG_NODE_TYPE_FILTER_PRIMITIVE_IMAGE); | ||
395 | filter->super.in = g_string_new ("none"); | ||
396 | filter->super.result = g_string_new ("none"); | ||
397 | filter->super.x.factor = filter->super.y.factor = filter->super.width.factor = | ||
398 | @@ -3871,8 +3875,8 @@ get_light_colour (RsvgNodeLightSource * source, vector3 colour, | ||
399 | |||
400 | |||
401 | static void | ||
402 | -rsvg_filter_primitive_light_source_set_atts (RsvgNode * self, | ||
403 | - RsvgHandle * ctx, RsvgPropertyBag * atts) | ||
404 | +rsvg_node_light_source_set_atts (RsvgNode * self, | ||
405 | + RsvgHandle * ctx, RsvgPropertyBag * atts) | ||
406 | { | ||
407 | RsvgNodeLightSource *data; | ||
408 | const char *value; | ||
409 | @@ -3904,13 +3908,13 @@ rsvg_filter_primitive_light_source_set_atts (RsvgNode * self, | ||
410 | } | ||
411 | |||
412 | RsvgNode * | ||
413 | -rsvg_new_filter_primitive_light_source (char type) | ||
414 | +rsvg_new_node_light_source (char type) | ||
415 | { | ||
416 | RsvgNodeLightSource *data; | ||
417 | data = g_new (RsvgNodeLightSource, 1); | ||
418 | - _rsvg_node_init (&data->super); | ||
419 | + _rsvg_node_init (&data->super, RSVG_NODE_TYPE_LIGHT_SOURCE); | ||
420 | data->super.free = _rsvg_node_free; | ||
421 | - data->super.set_atts = rsvg_filter_primitive_light_source_set_atts; | ||
422 | + data->super.set_atts = rsvg_node_light_source_set_atts; | ||
423 | data->specularExponent = 1; | ||
424 | if (type == 's') | ||
425 | data->type = SPOTLIGHT; | ||
426 | @@ -3960,10 +3964,11 @@ rsvg_filter_primitive_diffuse_lighting_render (RsvgFilterPrimitive * self, RsvgF | ||
427 | |||
428 | for (i = 0; i < self->super.children->len; i++) { | ||
429 | RsvgNode *temp; | ||
430 | + | ||
431 | temp = g_ptr_array_index (self->super.children, i); | ||
432 | - if (!strcmp (temp->type->str, "feDistantLight") || | ||
433 | - !strcmp (temp->type->str, "fePointLight") || !strcmp (temp->type->str, "feSpotLight")) | ||
434 | + if (RSVG_NODE_TYPE (temp) == RSVG_NODE_TYPE_LIGHT_SOURCE) { | ||
435 | source = (RsvgNodeLightSource *) temp; | ||
436 | + } | ||
437 | } | ||
438 | if (source == NULL) | ||
439 | return; | ||
440 | @@ -4080,7 +4085,7 @@ rsvg_new_filter_primitive_diffuse_lighting (void) | ||
441 | { | ||
442 | RsvgFilterPrimitiveDiffuseLighting *filter; | ||
443 | filter = g_new (RsvgFilterPrimitiveDiffuseLighting, 1); | ||
444 | - _rsvg_node_init (&filter->super.super); | ||
445 | + _rsvg_node_init (&filter->super.super, RSVG_NODE_TYPE_FILTER_PRIMITIVE_DIFFUSE_LIGHTING); | ||
446 | filter->super.in = g_string_new ("none"); | ||
447 | filter->super.result = g_string_new ("none"); | ||
448 | filter->super.x.factor = filter->super.y.factor = filter->super.width.factor = | ||
449 | @@ -4135,9 +4140,9 @@ rsvg_filter_primitive_specular_lighting_render (RsvgFilterPrimitive * self, Rsvg | ||
450 | for (i = 0; i < self->super.children->len; i++) { | ||
451 | RsvgNode *temp; | ||
452 | temp = g_ptr_array_index (self->super.children, i); | ||
453 | - if (!strcmp (temp->type->str, "feDistantLight") || | ||
454 | - !strcmp (temp->type->str, "fePointLight") || !strcmp (temp->type->str, "feSpotLight")) | ||
455 | + if (RSVG_NODE_TYPE (temp) == RSVG_NODE_TYPE_LIGHT_SOURCE) { | ||
456 | source = (RsvgNodeLightSource *) temp; | ||
457 | + } | ||
458 | } | ||
459 | if (source == NULL) | ||
460 | return; | ||
461 | @@ -4259,7 +4264,7 @@ rsvg_new_filter_primitive_specular_lighting (void) | ||
462 | { | ||
463 | RsvgFilterPrimitiveSpecularLighting *filter; | ||
464 | filter = g_new (RsvgFilterPrimitiveSpecularLighting, 1); | ||
465 | - _rsvg_node_init (&filter->super.super); | ||
466 | + _rsvg_node_init (&filter->super.super, RSVG_NODE_TYPE_FILTER_PRIMITIVE_SPECULAR_LIGHTING); | ||
467 | filter->super.in = g_string_new ("none"); | ||
468 | filter->super.result = g_string_new ("none"); | ||
469 | filter->super.x.factor = filter->super.y.factor = filter->super.width.factor = | ||
470 | @@ -4381,7 +4386,7 @@ rsvg_new_filter_primitive_tile (void) | ||
471 | { | ||
472 | RsvgFilterPrimitiveTile *filter; | ||
473 | filter = g_new (RsvgFilterPrimitiveTile, 1); | ||
474 | - _rsvg_node_init (&filter->super.super); | ||
475 | + _rsvg_node_init (&filter->super.super, RSVG_NODE_TYPE_FILTER_PRIMITIVE_TILE); | ||
476 | filter->super.in = g_string_new ("none"); | ||
477 | filter->super.result = g_string_new ("none"); | ||
478 | filter->super.x.factor = filter->super.y.factor = filter->super.width.factor = | ||
479 | diff --git a/rsvg-filter.h b/rsvg-filter.h | ||
480 | index 25dac75..0aeda22 100644 | ||
481 | --- a/rsvg-filter.h | ||
482 | +++ b/rsvg-filter.h | ||
483 | @@ -64,7 +64,7 @@ RsvgNode *rsvg_new_filter_primitive_displacement_map (void); | ||
484 | RsvgNode *rsvg_new_filter_primitive_turbulence (void); | ||
485 | RsvgNode *rsvg_new_filter_primitive_image (void); | ||
486 | RsvgNode *rsvg_new_filter_primitive_diffuse_lighting (void); | ||
487 | -RsvgNode *rsvg_new_filter_primitive_light_source (char type); | ||
488 | +RsvgNode *rsvg_new_node_light_source (char type); | ||
489 | RsvgNode *rsvg_new_filter_primitive_specular_lighting (void); | ||
490 | RsvgNode *rsvg_new_filter_primitive_tile (void); | ||
491 | |||
492 | diff --git a/rsvg-image.c b/rsvg-image.c | ||
493 | index a81dcf5..02882bd 100644 | ||
494 | --- a/rsvg-image.c | ||
495 | +++ b/rsvg-image.c | ||
496 | @@ -356,7 +356,7 @@ rsvg_new_image (void) | ||
497 | { | ||
498 | RsvgNodeImage *image; | ||
499 | image = g_new (RsvgNodeImage, 1); | ||
500 | - _rsvg_node_init (&image->super); | ||
501 | + _rsvg_node_init (&image->super, RSVG_NODE_TYPE_IMAGE); | ||
502 | g_assert (image->super.state); | ||
503 | image->img = NULL; | ||
504 | image->preserve_aspect_ratio = RSVG_ASPECT_RATIO_XMID_YMID; | ||
505 | diff --git a/rsvg-marker.c b/rsvg-marker.c | ||
506 | index 591e1e0..c7e76f1 100644 | ||
507 | --- a/rsvg-marker.c | ||
508 | +++ b/rsvg-marker.c | ||
509 | @@ -84,7 +84,7 @@ rsvg_new_marker (void) | ||
510 | { | ||
511 | RsvgMarker *marker; | ||
512 | marker = g_new (RsvgMarker, 1); | ||
513 | - _rsvg_node_init (&marker->super); | ||
514 | + _rsvg_node_init (&marker->super, RSVG_NODE_TYPE_MARKER); | ||
515 | marker->orient = 0; | ||
516 | marker->orientAuto = FALSE; | ||
517 | marker->preserve_aspect_ratio = RSVG_ASPECT_RATIO_XMID_YMID; | ||
518 | @@ -198,7 +198,7 @@ rsvg_marker_parse (const RsvgDefs * defs, const char *str) | ||
519 | val = rsvg_defs_lookup (defs, name); | ||
520 | g_free (name); | ||
521 | |||
522 | - if (val && (!strcmp (val->type->str, "marker"))) | ||
523 | + if (val && RSVG_NODE_TYPE (val) == RSVG_NODE_TYPE_MARKER) | ||
524 | return val; | ||
525 | } | ||
526 | return NULL; | ||
527 | diff --git a/rsvg-mask.c b/rsvg-mask.c | ||
528 | index dd36a38..8e3cba3 100644 | ||
529 | --- a/rsvg-mask.c | ||
530 | +++ b/rsvg-mask.c | ||
531 | @@ -74,7 +74,7 @@ rsvg_new_mask (void) | ||
532 | RsvgMask *mask; | ||
533 | |||
534 | mask = g_new (RsvgMask, 1); | ||
535 | - _rsvg_node_init (&mask->super); | ||
536 | + _rsvg_node_init (&mask->super, RSVG_NODE_TYPE_MASK); | ||
537 | mask->maskunits = objectBoundingBox; | ||
538 | mask->contentunits = userSpaceOnUse; | ||
539 | mask->x = _rsvg_css_parse_length ("0"); | ||
540 | @@ -113,7 +113,7 @@ rsvg_mask_parse (const RsvgDefs * defs, const char *str) | ||
541 | val = rsvg_defs_lookup (defs, name); | ||
542 | g_free (name); | ||
543 | |||
544 | - if (val && (!strcmp (val->type->str, "mask"))) | ||
545 | + if (val && RSVG_NODE_TYPE (val) == RSVG_NODE_TYPE_MASK) | ||
546 | return val; | ||
547 | } | ||
548 | return NULL; | ||
549 | @@ -130,7 +130,7 @@ rsvg_clip_path_parse (const RsvgDefs * defs, const char *str) | ||
550 | val = rsvg_defs_lookup (defs, name); | ||
551 | g_free (name); | ||
552 | |||
553 | - if (val && (!strcmp (val->type->str, "clipPath"))) | ||
554 | + if (val && RSVG_NODE_TYPE (val) == RSVG_NODE_TYPE_CLIP_PATH) | ||
555 | return val; | ||
556 | } | ||
557 | return NULL; | ||
558 | @@ -168,7 +168,7 @@ rsvg_new_clip_path (void) | ||
559 | RsvgClipPath *clip_path; | ||
560 | |||
561 | clip_path = g_new (RsvgClipPath, 1); | ||
562 | - _rsvg_node_init (&clip_path->super); | ||
563 | + _rsvg_node_init (&clip_path->super, RSVG_NODE_TYPE_CLIP_PATH); | ||
564 | clip_path->units = userSpaceOnUse; | ||
565 | clip_path->super.set_atts = rsvg_clip_path_set_atts; | ||
566 | clip_path->super.free = _rsvg_node_free; | ||
567 | diff --git a/rsvg-paint-server.c b/rsvg-paint-server.c | ||
568 | index 4967e03..7903684 100644 | ||
569 | --- a/rsvg-paint-server.c | ||
570 | +++ b/rsvg-paint-server.c | ||
571 | @@ -129,11 +129,11 @@ rsvg_paint_server_parse (gboolean * inherit, const RsvgDefs * defs, const char * | ||
572 | |||
573 | if (val == NULL) | ||
574 | return NULL; | ||
575 | - if (!strcmp (val->type->str, "linearGradient")) | ||
576 | + if (RSVG_NODE_TYPE (val) == RSVG_NODE_TYPE_LINEAR_GRADIENT) | ||
577 | return rsvg_paint_server_lin_grad ((RsvgLinearGradient *) val); | ||
578 | - else if (!strcmp (val->type->str, "radialGradient")) | ||
579 | + else if (RSVG_NODE_TYPE (val) == RSVG_NODE_TYPE_RADIAL_GRADIENT) | ||
580 | return rsvg_paint_server_rad_grad ((RsvgRadialGradient *) val); | ||
581 | - else if (!strcmp (val->type->str, "pattern")) | ||
582 | + else if (RSVG_NODE_TYPE (val) == RSVG_NODE_TYPE_PATTERN) | ||
583 | return rsvg_paint_server_pattern ((RsvgPattern *) val); | ||
584 | else | ||
585 | return NULL; | ||
586 | @@ -224,7 +224,7 @@ RsvgNode * | ||
587 | rsvg_new_stop (void) | ||
588 | { | ||
589 | RsvgGradientStop *stop = g_new (RsvgGradientStop, 1); | ||
590 | - _rsvg_node_init (&stop->super); | ||
591 | + _rsvg_node_init (&stop->super, RSVG_NODE_TYPE_STOP); | ||
592 | stop->super.set_atts = rsvg_stop_set_atts; | ||
593 | stop->offset = 0; | ||
594 | stop->rgba = 0; | ||
595 | @@ -293,7 +293,7 @@ rsvg_new_linear_gradient (void) | ||
596 | { | ||
597 | RsvgLinearGradient *grad = NULL; | ||
598 | grad = g_new (RsvgLinearGradient, 1); | ||
599 | - _rsvg_node_init (&grad->super); | ||
600 | + _rsvg_node_init (&grad->super, RSVG_NODE_TYPE_LINEAR_GRADIENT); | ||
601 | _rsvg_affine_identity (grad->affine); | ||
602 | grad->has_current_color = FALSE; | ||
603 | grad->x1 = grad->y1 = grad->y2 = _rsvg_css_parse_length ("0"); | ||
604 | @@ -376,7 +376,7 @@ rsvg_new_radial_gradient (void) | ||
605 | { | ||
606 | |||
607 | RsvgRadialGradient *grad = g_new (RsvgRadialGradient, 1); | ||
608 | - _rsvg_node_init (&grad->super); | ||
609 | + _rsvg_node_init (&grad->super, RSVG_NODE_TYPE_RADIAL_GRADIENT); | ||
610 | _rsvg_affine_identity (grad->affine); | ||
611 | grad->has_current_color = FALSE; | ||
612 | grad->obj_bbox = TRUE; | ||
613 | @@ -458,7 +458,7 @@ RsvgNode * | ||
614 | rsvg_new_pattern (void) | ||
615 | { | ||
616 | RsvgPattern *pattern = g_new (RsvgPattern, 1); | ||
617 | - _rsvg_node_init (&pattern->super); | ||
618 | + _rsvg_node_init (&pattern->super, RSVG_NODE_TYPE_PATTERN); | ||
619 | pattern->obj_bbox = TRUE; | ||
620 | pattern->obj_cbbox = FALSE; | ||
621 | pattern->x = pattern->y = pattern->width = pattern->height = _rsvg_css_parse_length ("0"); | ||
622 | @@ -477,7 +477,8 @@ hasstop (GPtrArray * lookin) | ||
623 | { | ||
624 | unsigned int i; | ||
625 | for (i = 0; i < lookin->len; i++) { | ||
626 | - if (!strcmp (((RsvgNode *) g_ptr_array_index (lookin, i))->type->str, "stop")) | ||
627 | + RsvgNode *node = g_ptr_array_index (lookin, i); | ||
628 | + if (RSVG_NODE_TYPE (node) == RSVG_NODE_TYPE_STOP) | ||
629 | return 1; | ||
630 | } | ||
631 | return 0; | ||
632 | @@ -490,7 +491,7 @@ rsvg_linear_gradient_fix_fallback (RsvgLinearGradient * grad) | ||
633 | int i; | ||
634 | ufallback = grad->fallback; | ||
635 | while (ufallback != NULL) { | ||
636 | - if (!strcmp (ufallback->type->str, "linearGradient")) { | ||
637 | + if (RSVG_NODE_TYPE (ufallback) == RSVG_NODE_TYPE_LINEAR_GRADIENT) { | ||
638 | RsvgLinearGradient *fallback = (RsvgLinearGradient *) ufallback; | ||
639 | if (!grad->hasx1 && fallback->hasx1) { | ||
640 | grad->hasx1 = TRUE; | ||
641 | @@ -525,7 +526,7 @@ rsvg_linear_gradient_fix_fallback (RsvgLinearGradient * grad) | ||
642 | grad->super.children = fallback->super.children; | ||
643 | } | ||
644 | ufallback = fallback->fallback; | ||
645 | - } else if (!strcmp (ufallback->type->str, "radialGradient")) { | ||
646 | + } else if (RSVG_NODE_TYPE (ufallback) == RSVG_NODE_TYPE_RADIAL_GRADIENT) { | ||
647 | RsvgRadialGradient *fallback = (RsvgRadialGradient *) ufallback; | ||
648 | if (!grad->hastransform && fallback->hastransform) { | ||
649 | grad->hastransform = TRUE; | ||
650 | @@ -555,7 +556,7 @@ rsvg_radial_gradient_fix_fallback (RsvgRadialGradient * grad) | ||
651 | int i; | ||
652 | ufallback = grad->fallback; | ||
653 | while (ufallback != NULL) { | ||
654 | - if (!strcmp (ufallback->type->str, "radialGradient")) { | ||
655 | + if (RSVG_NODE_TYPE (ufallback) == RSVG_NODE_TYPE_RADIAL_GRADIENT) { | ||
656 | RsvgRadialGradient *fallback = (RsvgRadialGradient *) ufallback; | ||
657 | if (!grad->hascx && fallback->hascx) { | ||
658 | grad->hascx = TRUE; | ||
659 | @@ -594,7 +595,7 @@ rsvg_radial_gradient_fix_fallback (RsvgRadialGradient * grad) | ||
660 | grad->super.children = fallback->super.children; | ||
661 | } | ||
662 | ufallback = fallback->fallback; | ||
663 | - } else if (!strcmp (ufallback->type->str, "linearGradient")) { | ||
664 | + } else if (RSVG_NODE_TYPE (ufallback) == RSVG_NODE_TYPE_LINEAR_GRADIENT) { | ||
665 | RsvgLinearGradient *fallback = (RsvgLinearGradient *) ufallback; | ||
666 | if (!grad->hastransform && fallback->hastransform) { | ||
667 | grad->hastransform = TRUE; | ||
668 | diff --git a/rsvg-private.h b/rsvg-private.h | ||
669 | index 288c2de..162917a 100644 | ||
670 | --- a/rsvg-private.h | ||
671 | +++ b/rsvg-private.h | ||
672 | @@ -255,16 +255,74 @@ struct RsvgSizeCallbackData { | ||
673 | |||
674 | void _rsvg_size_callback (int *width, int *height, gpointer data); | ||
675 | |||
676 | +typedef enum { | ||
677 | + RSVG_NODE_TYPE_INVALID = 0, | ||
678 | + | ||
679 | + RSVG_NODE_TYPE_CHARS, | ||
680 | + RSVG_NODE_TYPE_CIRCLE, | ||
681 | + RSVG_NODE_TYPE_CLIP_PATH, | ||
682 | + RSVG_NODE_TYPE_COMPONENT_TRANFER_FUNCTION, | ||
683 | + RSVG_NODE_TYPE_DEFS, | ||
684 | + RSVG_NODE_TYPE_ELLIPSE, | ||
685 | + RSVG_NODE_TYPE_FILTER, | ||
686 | + RSVG_NODE_TYPE_GROUP, | ||
687 | + RSVG_NODE_TYPE_IMAGE, | ||
688 | + RSVG_NODE_TYPE_LIGHT_SOURCE, | ||
689 | + RSVG_NODE_TYPE_LINE, | ||
690 | + RSVG_NODE_TYPE_LINEAR_GRADIENT, | ||
691 | + RSVG_NODE_TYPE_MARKER, | ||
692 | + RSVG_NODE_TYPE_MASK, | ||
693 | + RSVG_NODE_TYPE_PATH, | ||
694 | + RSVG_NODE_TYPE_PATTERN, | ||
695 | + RSVG_NODE_TYPE_POLYGON, | ||
696 | + RSVG_NODE_TYPE_POLYLINE, | ||
697 | + RSVG_NODE_TYPE_RADIAL_GRADIENT, | ||
698 | + RSVG_NODE_TYPE_RECT, | ||
699 | + RSVG_NODE_TYPE_STOP, | ||
700 | + RSVG_NODE_TYPE_SVG, | ||
701 | + RSVG_NODE_TYPE_SWITCH, | ||
702 | + RSVG_NODE_TYPE_SYMBOL, | ||
703 | + RSVG_NODE_TYPE_TEXT, | ||
704 | + RSVG_NODE_TYPE_TREF, | ||
705 | + RSVG_NODE_TYPE_TSPAN, | ||
706 | + RSVG_NODE_TYPE_USE, | ||
707 | + | ||
708 | + /* Filter primitives */ | ||
709 | + RSVG_NODE_TYPE_FILTER_PRIMITIVE = 64, | ||
710 | + RSVG_NODE_TYPE_FILTER_PRIMITIVE_BLEND, | ||
711 | + RSVG_NODE_TYPE_FILTER_PRIMITIVE_COLOUR_MATRIX, | ||
712 | + RSVG_NODE_TYPE_FILTER_PRIMITIVE_COMPONENT_TRANSFER, | ||
713 | + RSVG_NODE_TYPE_FILTER_PRIMITIVE_COMPOSITE, | ||
714 | + RSVG_NODE_TYPE_FILTER_PRIMITIVE_CONVOLVE_MATRIX, | ||
715 | + RSVG_NODE_TYPE_FILTER_PRIMITIVE_DIFFUSE_LIGHTING, | ||
716 | + RSVG_NODE_TYPE_FILTER_PRIMITIVE_DISPLACEMENT_MAP, | ||
717 | + RSVG_NODE_TYPE_FILTER_PRIMITIVE_ERODE, | ||
718 | + RSVG_NODE_TYPE_FILTER_PRIMITIVE_FLOOD, | ||
719 | + RSVG_NODE_TYPE_FILTER_PRIMITIVE_GAUSSIAN_BLUR, | ||
720 | + RSVG_NODE_TYPE_FILTER_PRIMITIVE_IMAGE, | ||
721 | + RSVG_NODE_TYPE_FILTER_PRIMITIVE_MERGE, | ||
722 | + RSVG_NODE_TYPE_FILTER_PRIMITIVE_MERGE_NODE, | ||
723 | + RSVG_NODE_TYPE_FILTER_PRIMITIVE_OFFSET, | ||
724 | + RSVG_NODE_TYPE_FILTER_PRIMITIVE_SPECULAR_LIGHTING, | ||
725 | + RSVG_NODE_TYPE_FILTER_PRIMITIVE_TILE, | ||
726 | + RSVG_NODE_TYPE_FILTER_PRIMITIVE_TURBULENCE, | ||
727 | + | ||
728 | +} RsvgNodeType; | ||
729 | + | ||
730 | struct _RsvgNode { | ||
731 | RsvgState *state; | ||
732 | RsvgNode *parent; | ||
733 | - GString *type; | ||
734 | GPtrArray *children; | ||
735 | + RsvgNodeType type; | ||
736 | + const char *name; /* owned by the xmlContext, invalid after parsing! */ | ||
737 | void (*free) (RsvgNode * self); | ||
738 | void (*draw) (RsvgNode * self, RsvgDrawingCtx * ctx, int dominate); | ||
739 | void (*set_atts) (RsvgNode * self, RsvgHandle * ctx, RsvgPropertyBag *); | ||
740 | }; | ||
741 | |||
742 | +#define RSVG_NODE_TYPE(node) ((node)->type) | ||
743 | +#define RSVG_NODE_IS_FILTER_PRIMITIVE(node) (RSVG_NODE_TYPE((node)) & RSVG_NODE_TYPE_FILTER_PRIMITIVE) | ||
744 | + | ||
745 | struct _RsvgNodeChars { | ||
746 | RsvgNode super; | ||
747 | GString *contents; | ||
748 | diff --git a/rsvg-shapes.c b/rsvg-shapes.c | ||
749 | index d481abf..07baf24 100644 | ||
750 | --- a/rsvg-shapes.c | ||
751 | +++ b/rsvg-shapes.c | ||
752 | @@ -89,7 +89,7 @@ rsvg_new_path (void) | ||
753 | { | ||
754 | RsvgNodePath *path; | ||
755 | path = g_new (RsvgNodePath, 1); | ||
756 | - _rsvg_node_init (&path->super); | ||
757 | + _rsvg_node_init (&path->super, RSVG_NODE_TYPE_PATH); | ||
758 | path->d = NULL; | ||
759 | path->super.free = rsvg_node_path_free; | ||
760 | path->super.draw = rsvg_node_path_draw; | ||
761 | @@ -101,7 +101,6 @@ rsvg_new_path (void) | ||
762 | struct _RsvgNodePoly { | ||
763 | RsvgNode super; | ||
764 | gdouble *pointlist; | ||
765 | - gboolean is_polyline; | ||
766 | guint pointlist_len; | ||
767 | }; | ||
768 | |||
769 | @@ -126,7 +125,8 @@ _rsvg_node_poly_set_atts (RsvgNode * self, RsvgHandle * ctx, RsvgPropertyBag * a | ||
770 | rsvg_defs_register_name (ctx->priv->defs, value, self); | ||
771 | } | ||
772 | |||
773 | - rsvg_parse_style_attrs (ctx, self->state, (poly->is_polyline ? "polyline" : "polygon"), | ||
774 | + rsvg_parse_style_attrs (ctx, self->state, | ||
775 | + RSVG_NODE_TYPE (self) == RSVG_NODE_TYPE_POLYLINE ? "polyline" : "polygon", | ||
776 | klazz, id, atts); | ||
777 | } | ||
778 | |||
779 | @@ -160,7 +160,7 @@ _rsvg_node_poly_draw (RsvgNode * self, RsvgDrawingCtx * ctx, int dominate) | ||
780 | g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), poly->pointlist[i + 1])); | ||
781 | } | ||
782 | |||
783 | - if (!poly->is_polyline) | ||
784 | + if (RSVG_NODE_TYPE (self) == RSVG_NODE_TYPE_POLYGON) | ||
785 | g_string_append (d, " Z"); | ||
786 | |||
787 | rsvg_state_reinherit_top (ctx, self->state, dominate); | ||
788 | @@ -181,16 +181,15 @@ _rsvg_node_poly_free (RsvgNode * self) | ||
789 | |||
790 | |||
791 | static RsvgNode * | ||
792 | -rsvg_new_any_poly (gboolean is_polyline) | ||
793 | +rsvg_new_any_poly (RsvgNodeType type) | ||
794 | { | ||
795 | RsvgNodePoly *poly; | ||
796 | poly = g_new (RsvgNodePoly, 1); | ||
797 | - _rsvg_node_init (&poly->super); | ||
798 | + _rsvg_node_init (&poly->super, type); | ||
799 | poly->super.free = _rsvg_node_poly_free; | ||
800 | poly->super.draw = _rsvg_node_poly_draw; | ||
801 | poly->super.set_atts = _rsvg_node_poly_set_atts; | ||
802 | poly->pointlist = NULL; | ||
803 | - poly->is_polyline = is_polyline; | ||
804 | poly->pointlist_len = 0; | ||
805 | return &poly->super; | ||
806 | } | ||
807 | @@ -198,13 +197,13 @@ rsvg_new_any_poly (gboolean is_polyline) | ||
808 | RsvgNode * | ||
809 | rsvg_new_polygon (void) | ||
810 | { | ||
811 | - return rsvg_new_any_poly (FALSE); | ||
812 | + return rsvg_new_any_poly (RSVG_NODE_TYPE_POLYGON); | ||
813 | } | ||
814 | |||
815 | RsvgNode * | ||
816 | rsvg_new_polyline (void) | ||
817 | { | ||
818 | - return rsvg_new_any_poly (TRUE); | ||
819 | + return rsvg_new_any_poly (RSVG_NODE_TYPE_POLYLINE); | ||
820 | } | ||
821 | |||
822 | |||
823 | @@ -275,7 +274,7 @@ rsvg_new_line (void) | ||
824 | { | ||
825 | RsvgNodeLine *line; | ||
826 | line = g_new (RsvgNodeLine, 1); | ||
827 | - _rsvg_node_init (&line->super); | ||
828 | + _rsvg_node_init (&line->super, RSVG_NODE_TYPE_LINE); | ||
829 | line->super.draw = _rsvg_node_line_draw; | ||
830 | line->super.set_atts = _rsvg_node_line_set_atts; | ||
831 | line->x1 = line->x2 = line->y1 = line->y2 = _rsvg_css_parse_length ("0"); | ||
832 | @@ -451,7 +450,7 @@ rsvg_new_rect (void) | ||
833 | { | ||
834 | RsvgNodeRect *rect; | ||
835 | rect = g_new (RsvgNodeRect, 1); | ||
836 | - _rsvg_node_init (&rect->super); | ||
837 | + _rsvg_node_init (&rect->super, RSVG_NODE_TYPE_RECT); | ||
838 | rect->super.draw = _rsvg_node_rect_draw; | ||
839 | rect->super.set_atts = _rsvg_node_rect_set_atts; | ||
840 | rect->x = rect->y = rect->w = rect->h = rect->rx = rect->ry = _rsvg_css_parse_length ("0"); | ||
841 | @@ -577,7 +576,7 @@ rsvg_new_circle (void) | ||
842 | { | ||
843 | RsvgNodeCircle *circle; | ||
844 | circle = g_new (RsvgNodeCircle, 1); | ||
845 | - _rsvg_node_init (&circle->super); | ||
846 | + _rsvg_node_init (&circle->super, RSVG_NODE_TYPE_CIRCLE); | ||
847 | circle->super.draw = _rsvg_node_circle_draw; | ||
848 | circle->super.set_atts = _rsvg_node_circle_set_atts; | ||
849 | circle->cx = circle->cy = circle->r = _rsvg_css_parse_length ("0"); | ||
850 | @@ -703,7 +702,7 @@ rsvg_new_ellipse (void) | ||
851 | { | ||
852 | RsvgNodeEllipse *ellipse; | ||
853 | ellipse = g_new (RsvgNodeEllipse, 1); | ||
854 | - _rsvg_node_init (&ellipse->super); | ||
855 | + _rsvg_node_init (&ellipse->super, RSVG_NODE_TYPE_ELLIPSE); | ||
856 | ellipse->super.draw = _rsvg_node_ellipse_draw; | ||
857 | ellipse->super.set_atts = _rsvg_node_ellipse_set_atts; | ||
858 | ellipse->cx = ellipse->cy = ellipse->rx = ellipse->ry = _rsvg_css_parse_length ("0"); | ||
859 | diff --git a/rsvg-shapes.h b/rsvg-shapes.h | ||
860 | index 7cf6621..baad98f 100644 | ||
861 | --- a/rsvg-shapes.h | ||
862 | +++ b/rsvg-shapes.h | ||
863 | @@ -34,7 +34,7 @@ | ||
864 | |||
865 | G_BEGIN_DECLS | ||
866 | |||
867 | -RsvgNode * rsvg_new_path (void); | ||
868 | +RsvgNode *rsvg_new_path (void); | ||
869 | RsvgNode *rsvg_new_polygon (void); | ||
870 | RsvgNode *rsvg_new_polyline (void); | ||
871 | RsvgNode *rsvg_new_line (void); | ||
872 | diff --git a/rsvg-structure.c b/rsvg-structure.c | ||
873 | index b078fea..33889be 100644 | ||
874 | --- a/rsvg-structure.c | ||
875 | +++ b/rsvg-structure.c | ||
876 | @@ -103,8 +103,10 @@ _rsvg_node_dont_set_atts (RsvgNode * node, RsvgHandle * ctx, RsvgPropertyBag * a | ||
877 | } | ||
878 | |||
879 | void | ||
880 | -_rsvg_node_init (RsvgNode * self) | ||
881 | +_rsvg_node_init (RsvgNode * self, | ||
882 | + RsvgNodeType type) | ||
883 | { | ||
884 | + self->type = type; | ||
885 | self->parent = NULL; | ||
886 | self->children = g_ptr_array_new (); | ||
887 | self->state = g_new (RsvgState, 1); | ||
888 | @@ -112,7 +114,6 @@ _rsvg_node_init (RsvgNode * self) | ||
889 | self->free = _rsvg_node_free; | ||
890 | self->draw = _rsvg_node_draw_nothing; | ||
891 | self->set_atts = _rsvg_node_dont_set_atts; | ||
892 | - self->type = NULL; | ||
893 | } | ||
894 | |||
895 | void | ||
896 | @@ -124,8 +125,6 @@ _rsvg_node_finalize (RsvgNode * self) | ||
897 | } | ||
898 | if (self->children != NULL) | ||
899 | g_ptr_array_free (self->children, TRUE); | ||
900 | - if (self->type != NULL) | ||
901 | - g_string_free (self->type, TRUE); | ||
902 | } | ||
903 | |||
904 | void | ||
905 | @@ -157,7 +156,7 @@ rsvg_new_group (void) | ||
906 | { | ||
907 | RsvgNodeGroup *group; | ||
908 | group = g_new (RsvgNodeGroup, 1); | ||
909 | - _rsvg_node_init (&group->super); | ||
910 | + _rsvg_node_init (&group->super, RSVG_NODE_TYPE_GROUP); | ||
911 | group->super.draw = _rsvg_node_draw_children; | ||
912 | group->super.set_atts = rsvg_node_group_set_atts; | ||
913 | return &group->super; | ||
914 | @@ -166,8 +165,8 @@ rsvg_new_group (void) | ||
915 | void | ||
916 | rsvg_pop_def_group (RsvgHandle * ctx) | ||
917 | { | ||
918 | - if (ctx->priv->currentnode != NULL) | ||
919 | - ctx->priv->currentnode = ctx->priv->currentnode->parent; | ||
920 | + g_assert (ctx->priv->currentnode != NULL); | ||
921 | + ctx->priv->currentnode = ctx->priv->currentnode->parent; | ||
922 | } | ||
923 | |||
924 | void | ||
925 | @@ -218,7 +217,7 @@ rsvg_node_use_draw (RsvgNode * self, RsvgDrawingCtx * ctx, int dominate) | ||
926 | return; | ||
927 | |||
928 | state = rsvg_current_state (ctx); | ||
929 | - if (strcmp (child->type->str, "symbol")) { | ||
930 | + if (RSVG_NODE_TYPE (child) != RSVG_NODE_TYPE_SYMBOL) { | ||
931 | _rsvg_affine_translate (affine, x, y); | ||
932 | _rsvg_affine_multiply (state->affine, affine, state->affine); | ||
933 | |||
934 | @@ -397,7 +396,7 @@ rsvg_new_svg (void) | ||
935 | { | ||
936 | RsvgNodeSvg *svg; | ||
937 | svg = g_new (RsvgNodeSvg, 1); | ||
938 | - _rsvg_node_init (&svg->super); | ||
939 | + _rsvg_node_init (&svg->super, RSVG_NODE_TYPE_SVG); | ||
940 | svg->vbox.active = FALSE; | ||
941 | svg->preserve_aspect_ratio = RSVG_ASPECT_RATIO_XMID_YMID; | ||
942 | svg->x = _rsvg_css_parse_length ("0"); | ||
943 | @@ -444,7 +443,7 @@ rsvg_new_use (void) | ||
944 | { | ||
945 | RsvgNodeUse *use; | ||
946 | use = g_new (RsvgNodeUse, 1); | ||
947 | - _rsvg_node_init (&use->super); | ||
948 | + _rsvg_node_init (&use->super, RSVG_NODE_TYPE_USE); | ||
949 | use->super.draw = rsvg_node_use_draw; | ||
950 | use->super.set_atts = rsvg_node_use_set_atts; | ||
951 | use->x = _rsvg_css_parse_length ("0"); | ||
952 | @@ -485,7 +484,7 @@ rsvg_new_symbol (void) | ||
953 | { | ||
954 | RsvgNodeSymbol *symbol; | ||
955 | symbol = g_new (RsvgNodeSymbol, 1); | ||
956 | - _rsvg_node_init (&symbol->super); | ||
957 | + _rsvg_node_init (&symbol->super, RSVG_NODE_TYPE_SYMBOL); | ||
958 | symbol->vbox.active = FALSE; | ||
959 | symbol->preserve_aspect_ratio = RSVG_ASPECT_RATIO_XMID_YMID; | ||
960 | symbol->super.draw = _rsvg_node_draw_nothing; | ||
961 | @@ -498,7 +497,7 @@ rsvg_new_defs (void) | ||
962 | { | ||
963 | RsvgNodeGroup *group; | ||
964 | group = g_new (RsvgNodeGroup, 1); | ||
965 | - _rsvg_node_init (&group->super); | ||
966 | + _rsvg_node_init (&group->super, RSVG_NODE_TYPE_DEFS); | ||
967 | group->super.draw = _rsvg_node_draw_nothing; | ||
968 | group->super.set_atts = rsvg_node_group_set_atts; | ||
969 | return &group->super; | ||
970 | @@ -533,7 +532,7 @@ rsvg_new_switch (void) | ||
971 | { | ||
972 | RsvgNodeGroup *group; | ||
973 | group = g_new (RsvgNodeGroup, 1); | ||
974 | - _rsvg_node_init (&group->super); | ||
975 | + _rsvg_node_init (&group->super, RSVG_NODE_TYPE_SWITCH); | ||
976 | group->super.draw = _rsvg_node_switch_draw; | ||
977 | group->super.set_atts = rsvg_node_group_set_atts; | ||
978 | return &group->super; | ||
979 | diff --git a/rsvg-structure.h b/rsvg-structure.h | ||
980 | index d672977..7d17c82 100644 | ||
981 | --- a/rsvg-structure.h | ||
982 | +++ b/rsvg-structure.h | ||
983 | @@ -36,7 +36,7 @@ | ||
984 | |||
985 | G_BEGIN_DECLS | ||
986 | |||
987 | -RsvgNode * rsvg_new_use (void); | ||
988 | +RsvgNode *rsvg_new_use (void); | ||
989 | RsvgNode *rsvg_new_symbol (void); | ||
990 | RsvgNode *rsvg_new_svg (void); | ||
991 | RsvgNode *rsvg_new_defs (void); | ||
992 | @@ -50,6 +50,7 @@ typedef struct _RsvgNodeSvg RsvgNodeSvg; | ||
993 | |||
994 | struct _RsvgNodeGroup { | ||
995 | RsvgNode super; | ||
996 | + char *name; | ||
997 | }; | ||
998 | |||
999 | struct _RsvgNodeSymbol { | ||
1000 | @@ -80,7 +81,7 @@ void rsvg_node_draw (RsvgNode * self, RsvgDrawingCtx * ctx, int dominate | ||
1001 | void _rsvg_node_draw_children (RsvgNode * self, RsvgDrawingCtx * ctx, int dominate); | ||
1002 | void _rsvg_node_finalize (RsvgNode * self); | ||
1003 | void _rsvg_node_free (RsvgNode * self); | ||
1004 | -void _rsvg_node_init (RsvgNode * self); | ||
1005 | +void _rsvg_node_init (RsvgNode * self, RsvgNodeType type); | ||
1006 | void _rsvg_node_svg_apply_atts (RsvgNodeSvg * self, RsvgHandle * ctx); | ||
1007 | |||
1008 | G_END_DECLS | ||
1009 | diff --git a/rsvg-text.c b/rsvg-text.c | ||
1010 | index 7066f24..89720de 100644 | ||
1011 | --- a/rsvg-text.c | ||
1012 | +++ b/rsvg-text.c | ||
1013 | @@ -170,17 +170,19 @@ _rsvg_node_text_type_children (RsvgNode * self, RsvgDrawingCtx * ctx, | ||
1014 | rsvg_push_discrete_layer (ctx); | ||
1015 | for (i = 0; i < self->children->len; i++) { | ||
1016 | RsvgNode *node = g_ptr_array_index (self->children, i); | ||
1017 | - if (!strcmp (node->type->str, "RSVG_NODE_CHARS")) { | ||
1018 | + RsvgNodeType type = RSVG_NODE_TYPE (node); | ||
1019 | + | ||
1020 | + if (type == RSVG_NODE_TYPE_CHARS) { | ||
1021 | RsvgNodeChars *chars = (RsvgNodeChars *) node; | ||
1022 | GString *str = _rsvg_text_chomp (rsvg_current_state (ctx), chars->contents, lastwasspace); | ||
1023 | rsvg_text_render_text (ctx, str->str, x, y); | ||
1024 | g_string_free (str, TRUE); | ||
1025 | - } else if (!strcmp (node->type->str, "tspan")) { | ||
1026 | + } else if (type == RSVG_NODE_TYPE_TSPAN) { | ||
1027 | RsvgNodeText *tspan = (RsvgNodeText *) node; | ||
1028 | rsvg_state_push (ctx); | ||
1029 | _rsvg_node_text_type_tspan (tspan, ctx, x, y, lastwasspace); | ||
1030 | rsvg_state_pop (ctx); | ||
1031 | - } else if (!strcmp (node->type->str, "tref")) { | ||
1032 | + } else if (type == RSVG_NODE_TYPE_TREF) { | ||
1033 | RsvgNodeTref *tref = (RsvgNodeTref *) node; | ||
1034 | _rsvg_node_text_type_tref (tref, ctx, x, y, lastwasspace); | ||
1035 | } | ||
1036 | @@ -206,17 +208,19 @@ _rsvg_node_text_length_children (RsvgNode * self, RsvgDrawingCtx * ctx, | ||
1037 | int out = FALSE; | ||
1038 | for (i = 0; i < self->children->len; i++) { | ||
1039 | RsvgNode *node = g_ptr_array_index (self->children, i); | ||
1040 | + RsvgNodeType type = RSVG_NODE_TYPE (node); | ||
1041 | + | ||
1042 | rsvg_state_push (ctx); | ||
1043 | rsvg_state_reinherit_top (ctx, node->state, 0); | ||
1044 | - if (!strcmp (node->type->str, "RSVG_NODE_CHARS")) { | ||
1045 | + if (type == RSVG_NODE_TYPE_CHARS) { | ||
1046 | RsvgNodeChars *chars = (RsvgNodeChars *) node; | ||
1047 | GString *str = _rsvg_text_chomp (rsvg_current_state (ctx), chars->contents, lastwasspace); | ||
1048 | *x += rsvg_text_length_text_as_string (ctx, str->str); | ||
1049 | g_string_free (str, TRUE); | ||
1050 | - } else if (!strcmp (node->type->str, "tspan")) { | ||
1051 | + } else if (type == RSVG_NODE_TYPE_TSPAN) { | ||
1052 | RsvgNodeText *tspan = (RsvgNodeText *) node; | ||
1053 | out = _rsvg_node_text_length_tspan (tspan, ctx, x, lastwasspace); | ||
1054 | - } else if (!strcmp (node->type->str, "tref")) { | ||
1055 | + } else if (type == RSVG_NODE_TYPE_TREF) { | ||
1056 | RsvgNodeTref *tref = (RsvgNodeTref *) node; | ||
1057 | out = _rsvg_node_text_length_tref (tref, ctx, x, lastwasspace); | ||
1058 | } | ||
1059 | @@ -259,7 +263,7 @@ rsvg_new_text (void) | ||
1060 | { | ||
1061 | RsvgNodeText *text; | ||
1062 | text = g_new (RsvgNodeText, 1); | ||
1063 | - _rsvg_node_init (&text->super); | ||
1064 | + _rsvg_node_init (&text->super, RSVG_NODE_TYPE_TEXT); | ||
1065 | text->super.draw = _rsvg_node_text_draw; | ||
1066 | text->super.set_atts = _rsvg_node_text_set_atts; | ||
1067 | text->x = text->y = text->dx = text->dy = _rsvg_css_parse_length ("0"); | ||
1068 | @@ -331,7 +335,7 @@ rsvg_new_tspan (void) | ||
1069 | { | ||
1070 | RsvgNodeText *text; | ||
1071 | text = g_new (RsvgNodeText, 1); | ||
1072 | - _rsvg_node_init (&text->super); | ||
1073 | + _rsvg_node_init (&text->super, RSVG_NODE_TYPE_TSPAN); | ||
1074 | text->super.set_atts = _rsvg_node_tspan_set_atts; | ||
1075 | text->x.factor = text->y.factor = 'n'; | ||
1076 | text->dx = text->dy = _rsvg_css_parse_length ("0"); | ||
1077 | @@ -374,7 +378,7 @@ rsvg_new_tref (void) | ||
1078 | { | ||
1079 | RsvgNodeTref *text; | ||
1080 | text = g_new (RsvgNodeTref, 1); | ||
1081 | - _rsvg_node_init (&text->super); | ||
1082 | + _rsvg_node_init (&text->super, RSVG_NODE_TYPE_TREF); | ||
1083 | text->super.set_atts = _rsvg_node_tref_set_atts; | ||
1084 | text->link = NULL; | ||
1085 | return &text->super; | ||
1086 | -- | ||
1087 | 1.7.0.5 | ||
1088 | |||
diff --git a/meta/recipes-gnome/librsvg/librsvg/gtk-option.patch b/meta/recipes-gnome/librsvg/librsvg/gtk-option.patch new file mode 100644 index 0000000000..9185041560 --- /dev/null +++ b/meta/recipes-gnome/librsvg/librsvg/gtk-option.patch | |||
@@ -0,0 +1,59 @@ | |||
1 | From 18917f7fd3160afe06019f4b6234aeb78a3fdb4e Mon Sep 17 00:00:00 2001 | ||
2 | From: Ross Burton <ross.burton@intel.com> | ||
3 | Date: Tue, 19 Nov 2013 16:00:29 +0000 | ||
4 | Subject: [PATCH] configure: add option to enable/disable use of GTK+ | ||
5 | |||
6 | Distro packagers like predictability and automatically detected optional | ||
7 | dependencies are not predicable. Add a --with-gtk3 option (default to "auto") | ||
8 | for forcibly controlling whether GTK+ will be used or not. | ||
9 | |||
10 | Signed-off-by: Ross Burton <ross.burton@intel.com> | ||
11 | |||
12 | https://bugzilla.gnome.org/show_bug.cgi?id=712693 | ||
13 | --- | ||
14 | configure.in | 17 +++++++++++------ | ||
15 | 1 file changed, 11 insertions(+), 6 deletions(-) | ||
16 | |||
17 | diff --git a/configure.in b/configure.in | ||
18 | index f7a89dc..1498f72 100644 | ||
19 | --- a/configure.in | ||
20 | +++ b/configure.in | ||
21 | @@ -119,17 +119,22 @@ AC_CHECK_FUNCS(strtok_r) | ||
22 | # GTK | ||
23 | # =========================================================================== | ||
24 | |||
25 | -PKG_CHECK_MODULES([GTK3],[gtk+-3.0 >= $GTK3_REQUIRED],[have_gtk_3=yes],[have_gtk_3=no]) | ||
26 | - | ||
27 | GTK3_BINARY_VERSION= | ||
28 | |||
29 | -if test "$have_gtk_3" = "yes"; then | ||
30 | - GTK3_BINARY_VERSION="`$PKG_CONFIG --variable=gtk_binary_version gtk+-3.0`" | ||
31 | +AC_MSG_CHECKING([whether to use GTK+ 3]) | ||
32 | +AC_ARG_WITH([gtk3], | ||
33 | + [AS_HELP_STRING([--without-gtk3],[Don't build GTK+3 tools (default=auto)])], | ||
34 | + [],[PKG_CHECK_EXISTS([gtk+-3.0 >= $GTK3_REQUIRED],[with_gtk3=yes],[with_gtk3=no])]) | ||
35 | +AC_MSG_RESULT([$with_gtk3]) | ||
36 | + | ||
37 | +if test "$with_gtk3" = "yes"; then | ||
38 | + PKG_CHECK_MODULES(GTK3, [gtk+-3.0 >= $GTK3_REQUIRED]) | ||
39 | + GTK3_BINARY_VERSION="`$PKG_CONFIG --variable=gtk_binary_version gtk+-3.0`" | ||
40 | fi | ||
41 | |||
42 | AC_SUBST([GTK3_BINARY_VERSION]) | ||
43 | |||
44 | -AM_CONDITIONAL([HAVE_GTK_3],[test "$have_gtk_3" = "yes"]) | ||
45 | +AM_CONDITIONAL([HAVE_GTK_3],[test "$with_gtk3" = "yes"]) | ||
46 | |||
47 | dnl =========================================================================== | ||
48 | dnl GDK-Pixbuf SVG loader | ||
49 | @@ -305,6 +310,6 @@ librsvg-$VERSION | ||
50 | Build introspectable bindings: ${found_introspection} | ||
51 | Build Vala bindings: ${enable_vala} | ||
52 | Build GdkPixbuf loader: ${enable_pixbuf_loader} | ||
53 | - GTK 3.0: ${have_gtk_3} | ||
54 | + GTK 3.0: ${with_gtk3} | ||
55 | Build miscellaenous tools: ${build_misc_tools} | ||
56 | " | ||
57 | -- | ||
58 | 1.7.10.4 | ||
59 | |||
diff --git a/meta/recipes-gnome/librsvg/librsvg/local-m4.patch b/meta/recipes-gnome/librsvg/librsvg/local-m4.patch new file mode 100644 index 0000000000..e523076fd1 --- /dev/null +++ b/meta/recipes-gnome/librsvg/librsvg/local-m4.patch | |||
@@ -0,0 +1,32 @@ | |||
1 | This patch is required to make autoreconf use the local macros (so that it can | ||
2 | autoreconf without vala being installed). | ||
3 | |||
4 | Upstream-Status: Backport | ||
5 | Signed-off-by: Ross Burton <ross.burton@intel.com> | ||
6 | |||
7 | From 6c3b8eee243204678574e162b7d480f6f83b71e6 Mon Sep 17 00:00:00 2001 | ||
8 | From: =?UTF-8?q?Germ=C3=A1n=20Poo-Caama=C3=B1o?= <gpoo@gnome.org> | ||
9 | Date: Tue, 29 Oct 2013 13:05:39 -0700 | ||
10 | Subject: [PATCH] build: Use local macros to detect vala | ||
11 | |||
12 | Fixes build when vala < 0.19 is present. | ||
13 | --- | ||
14 | Makefile.am | 2 +- | ||
15 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
16 | |||
17 | diff --git a/Makefile.am b/Makefile.am | ||
18 | index d95f008..e881100 100644 | ||
19 | --- a/Makefile.am | ||
20 | +++ b/Makefile.am | ||
21 | @@ -3,7 +3,7 @@ SUBDIRS = . gdk-pixbuf-loader tests tools doc | ||
22 | NULL = | ||
23 | BUILT_SOURCES = | ||
24 | |||
25 | -ACLOCAL_AMFLAGS = ${ACLOCAL_FLAGS} | ||
26 | +ACLOCAL_AMFLAGS = ${ACLOCAL_FLAGS} -I m4 | ||
27 | |||
28 | lib_LTLIBRARIES = librsvg-@RSVG_API_MAJOR_VERSION@.la | ||
29 | |||
30 | -- | ||
31 | 1.7.10.4 | ||
32 | |||
diff --git a/meta/recipes-gnome/librsvg/librsvg/vapigen.m4 b/meta/recipes-gnome/librsvg/librsvg/vapigen.m4 new file mode 100644 index 0000000000..f2df12f23f --- /dev/null +++ b/meta/recipes-gnome/librsvg/librsvg/vapigen.m4 | |||
@@ -0,0 +1,96 @@ | |||
1 | dnl vapigen.m4 | ||
2 | dnl | ||
3 | dnl Copyright 2012 Evan Nemerson | ||
4 | dnl | ||
5 | dnl This library is free software; you can redistribute it and/or | ||
6 | dnl modify it under the terms of the GNU Lesser General Public | ||
7 | dnl License as published by the Free Software Foundation; either | ||
8 | dnl version 2.1 of the License, or (at your option) any later version. | ||
9 | dnl | ||
10 | dnl This library is distributed in the hope that it will be useful, | ||
11 | dnl but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | dnl Lesser General Public License for more details. | ||
14 | dnl | ||
15 | dnl You should have received a copy of the GNU Lesser General Public | ||
16 | dnl License along with this library; if not, write to the Free Software | ||
17 | dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
18 | |||
19 | # VAPIGEN_CHECK([VERSION], [API_VERSION], [FOUND-INTROSPECTION], [DEFAULT]) | ||
20 | # -------------------------------------- | ||
21 | # Check vapigen existence and version | ||
22 | # | ||
23 | # See http://live.gnome.org/Vala/UpstreamGuide for detailed documentation | ||
24 | AC_DEFUN([VAPIGEN_CHECK], | ||
25 | [ | ||
26 | AC_BEFORE([GOBJECT_INTROSPECTION_CHECK],[$0]) | ||
27 | AC_BEFORE([GOBJECT_INTROSPECTION_REQUIRE],[$0]) | ||
28 | |||
29 | AC_ARG_ENABLE([vala], | ||
30 | [AS_HELP_STRING([--enable-vala[=@<:@no/auto/yes@:>@]],[build Vala bindings @<:@default=]ifelse($4,,auto,$4)[@:>@])],,[ | ||
31 | AS_IF([test "x$4" = "x"], [ | ||
32 | enable_vala=auto | ||
33 | ], [ | ||
34 | enable_vala=$4 | ||
35 | ]) | ||
36 | ]) | ||
37 | |||
38 | AS_CASE([$enable_vala], [no], [enable_vala=no], | ||
39 | [yes], [ | ||
40 | AS_IF([test "x$3" != "xyes" -a "x$found_introspection" != "xyes"], [ | ||
41 | AC_MSG_ERROR([Vala bindings require GObject Introspection]) | ||
42 | ]) | ||
43 | ], [auto], [ | ||
44 | AS_IF([test "x$3" != "xyes" -a "x$found_introspection" != "xyes"], [ | ||
45 | enable_vala=no | ||
46 | ]) | ||
47 | ], [ | ||
48 | AC_MSG_ERROR([Invalid argument passed to --enable-vala, should be one of @<:@no/auto/yes@:>@]) | ||
49 | ]) | ||
50 | |||
51 | AS_IF([test "x$2" = "x"], [ | ||
52 | vapigen_pkg_name=vapigen | ||
53 | ], [ | ||
54 | vapigen_pkg_name=vapigen-$2 | ||
55 | ]) | ||
56 | AS_IF([test "x$1" = "x"], [ | ||
57 | vapigen_pkg="$vapigen_pkg_name" | ||
58 | ], [ | ||
59 | vapigen_pkg="$vapigen_pkg_name >= $1" | ||
60 | ]) | ||
61 | |||
62 | PKG_PROG_PKG_CONFIG | ||
63 | |||
64 | PKG_CHECK_EXISTS([$vapigen_pkg], [ | ||
65 | AS_IF([test "$enable_vala" = "auto"], [ | ||
66 | enable_vala=yes | ||
67 | ]) | ||
68 | ], [ | ||
69 | AS_CASE([$enable_vala], [yes], [ | ||
70 | AC_MSG_ERROR([$vapigen_pkg not found]) | ||
71 | ], [auto], [ | ||
72 | enable_vala=no | ||
73 | ]) | ||
74 | ]) | ||
75 | |||
76 | AC_MSG_CHECKING([for vala]) | ||
77 | |||
78 | AS_CASE([$enable_vala], | ||
79 | [yes], [ | ||
80 | VAPIGEN=`$PKG_CONFIG --variable=vapigen vapigen` | ||
81 | VAPIGEN_MAKEFILE=`$PKG_CONFIG --variable=datadir vapigen`/vala/Makefile.vapigen | ||
82 | AS_IF([test "x$2" = "x"], [ | ||
83 | VAPIGEN_VAPIDIR=`$PKG_CONFIG --variable=vapidir vapigen` | ||
84 | ], [ | ||
85 | VAPIGEN_VAPIDIR=`$PKG_CONFIG --variable=vapidir_versioned vapigen` | ||
86 | ]) | ||
87 | ]) | ||
88 | |||
89 | AC_MSG_RESULT([$enable_vala]) | ||
90 | |||
91 | AC_SUBST([VAPIGEN]) | ||
92 | AC_SUBST([VAPIGEN_VAPIDIR]) | ||
93 | AC_SUBST([VAPIGEN_MAKEFILE]) | ||
94 | |||
95 | AM_CONDITIONAL(ENABLE_VAPIGEN, test "x$enable_vala" = "xyes") | ||
96 | ]) | ||
diff --git a/meta/recipes-gnome/librsvg/librsvg_2.32.1.bb b/meta/recipes-gnome/librsvg/librsvg_2.32.1.bb deleted file mode 100644 index 4818422e72..0000000000 --- a/meta/recipes-gnome/librsvg/librsvg_2.32.1.bb +++ /dev/null | |||
@@ -1,58 +0,0 @@ | |||
1 | DESCRIPTION = "Library for rendering SVG files" | ||
2 | HOMEPAGE = "http://ftp.gnome.org/pub/GNOME/sources/librsvg/" | ||
3 | BUGTRACKER = "https://bugzilla.gnome.org/" | ||
4 | |||
5 | LICENSE = "LGPLv2+" | ||
6 | LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f \ | ||
7 | file://rsvg.h;beginline=3;endline=24;md5=20b4113c4909bbf0d67e006778302bc6" | ||
8 | |||
9 | SECTION = "x11/utils" | ||
10 | DEPENDS = "cairo glib-2.0 gdk-pixbuf fontconfig freetype libxml2 pango" | ||
11 | DEPENDS += "gdk-pixbuf-native" | ||
12 | BBCLASSEXTEND = "native" | ||
13 | |||
14 | PR = "r12" | ||
15 | |||
16 | inherit autotools pkgconfig gnomebase gtk-doc pixbufcache | ||
17 | |||
18 | SRC_URI += "file://doc_Makefile.patch \ | ||
19 | file://librsvg-CVE-2011-3146.patch \ | ||
20 | " | ||
21 | |||
22 | SRC_URI[archive.md5sum] = "4b00d0fee130c936644892c152f42db7" | ||
23 | SRC_URI[archive.sha256sum] = "91b98051f352fab8a6257688d6b2fd665b4648ed66144861f2f853ccf876d334" | ||
24 | |||
25 | EXTRA_OECONF = "--without-svgz" | ||
26 | |||
27 | PACKAGECONFIG ??= "croco gdkpixbuf" | ||
28 | |||
29 | # Support embedded CSS stylesheets (recommended upstream) | ||
30 | PACKAGECONFIG[croco] = "--with-croco,--without-croco,libcroco" | ||
31 | # gdk-pixbuf loader | ||
32 | PACKAGECONFIG[gdkpixbuf] = "--enable-pixbuf-loader,--disable-pixbuf-loader" | ||
33 | # GTK+ 2 theme engine | ||
34 | PACKAGECONFIG[gtk] = "--enable-gtk-theme,--disable-gtk-theme,gtk+" | ||
35 | |||
36 | PACKAGES =+ "librsvg-gtk librsvg-gtk-dbg librsvg-gtk-dev rsvg" | ||
37 | FILES_${PN} = "${libdir}/*.so.*" | ||
38 | FILES_${PN}-staticdev += "${libdir}/gdk-pixbuf-2.0/*.a ${libdir}/gdk-pixbuf-2.0/*/*/*.a \ | ||
39 | ${libdir}/gtk-2.0/*.a ${libdir}/gtk-2.0/*/*/*.a" | ||
40 | FILES_rsvg = "${bindir}/rsvg \ | ||
41 | ${bindir}/rsvg-view \ | ||
42 | ${bindir}/rsvg-convert \ | ||
43 | ${datadir}/pixmaps/svg-viewer.svg \ | ||
44 | ${datadir}/themes" | ||
45 | FILES_librsvg-gtk = "${libdir}/gtk-2.0/*/*/*.so ${libdir}/gdk-pixbuf-2.0/*/*/*.so" | ||
46 | FILES_librsvg-gtk-dev += "${libdir}/gtk-2.0/*.la \ | ||
47 | ${libdir}/gtk-2.0/*/*/*.la \ | ||
48 | ${libdir}/gdk-pixbuf-2.0/*.la \ | ||
49 | ${libdir}/gdk-pixbuf-2.0/*/*/*.la" | ||
50 | FILES_librsvg-gtk-dbg += "${libdir}/gdk-pixbuf-2.0/.debug \ | ||
51 | ${libdir}/gdk-pixbuf-2.0/*/*/.debug \ | ||
52 | ${libdir}/gtk-2.0/.debug \ | ||
53 | ${libdir}/gtk-2.0/*/*/.debug" | ||
54 | |||
55 | PIXBUF_PACKAGES = "librsvg-gtk" | ||
56 | PARALLEL_MAKE = "" | ||
57 | |||
58 | PIXBUFCACHE_SYSROOT_DEPS_append_class-native = " harfbuzz-native:do_populate_sysroot_setscene pango-native:do_populate_sysroot_setscene icu-native:do_populate_sysroot_setscene" | ||
diff --git a/meta/recipes-gnome/librsvg/librsvg_2.40.0.bb b/meta/recipes-gnome/librsvg/librsvg_2.40.0.bb new file mode 100644 index 0000000000..143d1ef9ed --- /dev/null +++ b/meta/recipes-gnome/librsvg/librsvg_2.40.0.bb | |||
@@ -0,0 +1,56 @@ | |||
1 | DESCRIPTION = "Library for rendering SVG files" | ||
2 | HOMEPAGE = "http://ftp.gnome.org/pub/GNOME/sources/librsvg/" | ||
3 | BUGTRACKER = "https://bugzilla.gnome.org/" | ||
4 | |||
5 | LICENSE = "LGPLv2+" | ||
6 | LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f \ | ||
7 | file://rsvg.h;beginline=3;endline=24;md5=20b4113c4909bbf0d67e006778302bc6" | ||
8 | |||
9 | SECTION = "x11/utils" | ||
10 | DEPENDS = "gdk-pixbuf-native cairo gdk-pixbuf glib-2.0 libcroco libxml2 pango" | ||
11 | BBCLASSEXTEND = "native" | ||
12 | |||
13 | inherit autotools pkgconfig gnomebase gtk-doc pixbufcache | ||
14 | |||
15 | GNOME_COMPRESS_TYPE = "xz" | ||
16 | |||
17 | SRC_URI += "file://gtk-option.patch \ | ||
18 | file://local-m4.patch \ | ||
19 | file://vapigen.m4" | ||
20 | |||
21 | SRC_URI[archive.md5sum] = "e16a84e9a86a18e5ca6ba95c512db6c6" | ||
22 | SRC_URI[archive.sha256sum] = "8f7db31df235813dbd035888035cf862d682e7cc5706c4e7ec05750d3f64a2f9" | ||
23 | |||
24 | EXTRA_OECONF = "--disable-introspection --disable-vala" | ||
25 | |||
26 | PACKAGECONFIG ??= "gdkpixbuf" | ||
27 | # The gdk-pixbuf loader | ||
28 | PACKAGECONFIG[gdkpixbuf] = "--enable-pixbuf-loader,--disable-pixbuf-loader" | ||
29 | # GTK+ test application (rsvg-view) | ||
30 | PACKAGECONFIG[gtk] = "--with-gtk3,--without-gtk3,gtk+3" | ||
31 | |||
32 | # 2.40.1 should ship the tarball with local m4 macros, but until then drop a | ||
33 | # vapigen in there so we don't need to build vala to configure. | ||
34 | do_configure_prepend() { | ||
35 | if test ! -e ${S}/m4/vapigen.m4; then | ||
36 | mkdir --parents ${S}/m4 | ||
37 | mv ${WORKDIR}/vapigen.m4 ${S}/m4/ | ||
38 | fi | ||
39 | } | ||
40 | |||
41 | do_install_append() { | ||
42 | # Loadable modules don't need .a or .la on Linux | ||
43 | rm -f ${D}${libdir}/gdk-pixbuf-2.0/*/loaders/*.a ${D}${libdir}/gdk-pixbuf-2.0/*/loaders/*.la | ||
44 | } | ||
45 | |||
46 | PACKAGES =+ "librsvg-gtk rsvg" | ||
47 | FILES_${PN} = "${libdir}/*.so.*" | ||
48 | FILES_${PN}-dbg += "${libdir}/gdk-pixbuf-2.0/*/loaders/.debug" | ||
49 | FILES_rsvg = "${bindir}/rsvg* \ | ||
50 | ${datadir}/pixmaps/svg-viewer.svg \ | ||
51 | ${datadir}/themes" | ||
52 | FILES_librsvg-gtk = "${libdir}/gdk-pixbuf-2.0/*/*/*.so" | ||
53 | |||
54 | PIXBUF_PACKAGES = "librsvg-gtk" | ||
55 | |||
56 | PIXBUFCACHE_SYSROOT_DEPS_append_class-native = " harfbuzz-native:do_populate_sysroot_setscene pango-native:do_populate_sysroot_setscene icu-native:do_populate_sysroot_setscene" | ||