Mercurial > dwindows
comparison gtk/dw.c @ 1709:de49c1f284b2
Safety check for the icon resize code on Mac and GTK.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sat, 05 May 2012 21:41:57 +0000 |
parents | 0b1be0a99f59 |
children | df5f0857f765 |
comparison
equal
deleted
inserted
replaced
1708:cc10082567ed | 1709:de49c1f284b2 |
---|---|
6961 | 6961 |
6962 #if GTK_MAJOR_VERSION > 1 | 6962 #if GTK_MAJOR_VERSION > 1 |
6963 /* Internal function to keep HICNs from getting too big */ | 6963 /* Internal function to keep HICNs from getting too big */ |
6964 GdkPixbuf *_icon_resize(GdkPixbuf *ret) | 6964 GdkPixbuf *_icon_resize(GdkPixbuf *ret) |
6965 { | 6965 { |
6966 int pwidth = gdk_pixbuf_get_width(ret); | 6966 if(ret) |
6967 int pheight = gdk_pixbuf_get_height(ret); | 6967 { |
6968 | 6968 int pwidth = gdk_pixbuf_get_width(ret); |
6969 if(pwidth > 24 || pheight > 24) | 6969 int pheight = gdk_pixbuf_get_height(ret); |
6970 { | 6970 |
6971 GdkPixbuf *orig = ret; | 6971 if(pwidth > 24 || pheight > 24) |
6972 ret = gdk_pixbuf_scale_simple(ret, pwidth > 24 ? 24 : pwidth, pheight > 24 ? 24 : pheight, GDK_INTERP_BILINEAR); | 6972 { |
6973 g_object_unref(G_OBJECT(orig)); | 6973 GdkPixbuf *orig = ret; |
6974 ret = gdk_pixbuf_scale_simple(ret, pwidth > 24 ? 24 : pwidth, pheight > 24 ? 24 : pheight, GDK_INTERP_BILINEAR); | |
6975 g_object_unref(G_OBJECT(orig)); | |
6976 } | |
6974 } | 6977 } |
6975 return ret; | 6978 return ret; |
6976 } | 6979 } |
6977 #endif | 6980 #endif |
6978 | 6981 |