[librsvg/gnome-3-2] Don't create pixbufs with zero width or height
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg/gnome-3-2] Don't create pixbufs with zero width or height
- Date: Wed, 9 Nov 2011 21:16:16 +0000 (UTC)
commit ef28ade7613ed0ba8ef00b8afd3cea4e23e23055
Author: Christian Persch <chpe gnome org>
Date: Wed Nov 9 21:00:53 2011 +0100
Don't create pixbufs with zero width or height
This created lots and lots of critical warnings when rendering
tests/svg1.1/svg/filters-displace-01-f.svg:
GdkPixbuf-CRITICAL **: gdk_pixbuf_new: assertion `width > 0' failed
g_logv() [gmessages.c:779]
g_log() [gmessages.c:826]
g_return_if_fail_warning() [gmessages.c:838]
gdk_pixbuf_new() [gdk-pixbuf.c:338]
rsvg_filter_primitive_image_render_ext() [rsvg-filter.c:3376]
rsvg-filter.c | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/rsvg-filter.c b/rsvg-filter.c
index d358de5..5d071e7 100644
--- a/rsvg-filter.c
+++ b/rsvg-filter.c
@@ -3362,6 +3362,7 @@ rsvg_filter_primitive_image_render_ext (RsvgFilterPrimitive * self, RsvgFilterCo
unsigned char *pixels;
int channelmap[4];
int length;
+ int width, height;
upself = (RsvgFilterPrimitiveImage *) self;
@@ -3370,15 +3371,18 @@ rsvg_filter_primitive_image_render_ext (RsvgFilterPrimitive * self, RsvgFilterCo
boundarys = rsvg_filter_primitive_get_bounds (self, ctx);
+ width = boundarys.x1 - boundarys.x0;
+ height = boundarys.y1 - boundarys.y0;
+ if (width == 0 || height == 0)
+ return NULL;
+
img = rsvg_pixbuf_new_from_href (upself->href->str,
rsvg_handle_get_base_uri (upself->ctx), NULL);
if (!img)
return NULL;
-
- intermediate = gdk_pixbuf_new (GDK_COLORSPACE_RGB, 1, 8, boundarys.x1 - boundarys.x0,
- boundarys.y1 - boundarys.y0);
+ intermediate = gdk_pixbuf_new (GDK_COLORSPACE_RGB, 1, 8, width, height);
rsvg_art_affine_image (img, intermediate,
@@ -3391,7 +3395,6 @@ rsvg_filter_primitive_image_render_ext (RsvgFilterPrimitive * self, RsvgFilterCo
return NULL;
}
-
g_object_unref (img);
length = gdk_pixbuf_get_height (intermediate) * gdk_pixbuf_get_rowstride (intermediate);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]