gnumeric r16515 - in branches/gnumeric-1-8: . src
- From: mortenw svn gnome org
- To: svn-commits-list gnome org
- Subject: gnumeric r16515 - in branches/gnumeric-1-8: . src
- Date: Mon, 14 Apr 2008 14:54:34 +0100 (BST)
Author: mortenw
Date: Mon Apr 14 14:54:34 2008
New Revision: 16515
URL: http://svn.gnome.org/viewvc/gnumeric?rev=16515&view=rev
Log:
2008-04-14 Morten Welinder <terra gnome org>
* src/sheet-object-image.c (gnm_soi_default_size,
gnm_soi_draw_cairo): Protect against a NULL pixbuf.
Modified:
branches/gnumeric-1-8/ChangeLog
branches/gnumeric-1-8/src/sheet-object-image.c
Modified: branches/gnumeric-1-8/src/sheet-object-image.c
==============================================================================
--- branches/gnumeric-1-8/src/sheet-object-image.c (original)
+++ branches/gnumeric-1-8/src/sheet-object-image.c Mon Apr 14 14:54:34 2008
@@ -574,14 +574,20 @@
static void
gnm_soi_draw_cairo (SheetObject const *so, cairo_t *cr,
- double width, double height)
+ double width, double height)
{
- GdkPixbuf *pixbuf = soi_get_pixbuf (SHEET_OBJECT_IMAGE (so), 1.);
- GOImage *img = go_image_new_from_pixbuf (pixbuf);
- cairo_pattern_t *cr_pattern = go_image_create_cairo_pattern (img);
+ GdkPixbuf *pixbuf;
+ GOImage *img;
+ cairo_pattern_t *cr_pattern;
int w, h;
cairo_matrix_t cr_matrix;
+ pixbuf = soi_get_pixbuf (SHEET_OBJECT_IMAGE (so), 1.);
+ if (!pixbuf)
+ return;
+ img = go_image_new_from_pixbuf (pixbuf);
+ cr_pattern = go_image_create_cairo_pattern (img);
+
w = gdk_pixbuf_get_width (pixbuf);
h = gdk_pixbuf_get_height (pixbuf);
cairo_matrix_init_scale (&cr_matrix,
@@ -600,6 +606,12 @@
gnm_soi_default_size (SheetObject const *so, double *w, double *h)
{
GdkPixbuf *buf = soi_get_pixbuf (SHEET_OBJECT_IMAGE (so), 1.);
+
+ if (!buf) {
+ *w = *h = 5;
+ return;
+ }
+
*w = gdk_pixbuf_get_width (buf);
*h = gdk_pixbuf_get_height (buf);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]