Mercurial > pidgin
diff src/gtkimhtml.c @ 5046:44945824ba60
[gaim-migrate @ 5394]
javabsp fixed im image scaling
I fixed im image saving, and the button annoyingly staying toggled
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Sun, 06 Apr 2003 02:09:56 +0000 |
parents | 29c87c6e75d9 |
children | 04ded2f7253c |
line wrap: on
line diff
--- a/src/gtkimhtml.c Sun Apr 06 01:27:56 2003 +0000 +++ b/src/gtkimhtml.c Sun Apr 06 02:09:56 2003 +0000 @@ -1433,12 +1433,15 @@ GTK_IMHTML_SCALABLE(im_image)->scale = gaim_im_image_scale; GTK_IMHTML_SCALABLE(im_image)->add_to = gaim_im_image_add_to; GTK_IMHTML_SCALABLE(im_image)->free = gaim_im_image_free; + + im_image->pixbuf = img; im_image->image = image; im_image->width = gdk_pixbuf_get_width(img); im_image->height = gdk_pixbuf_get_height(img); im_image->mark = NULL; im_image->filename = filename; + g_object_ref(img); return GTK_IMHTML_SCALABLE(im_image); } @@ -1447,7 +1450,6 @@ gaim_im_image *image = (gaim_im_image *)scale; if(image->width > width || image->height > height){ - GdkPixbuf *old_image = gtk_image_get_pixbuf(image->image); GdkPixbuf *new_image = NULL; float factor; int new_width = image->width, new_height = image->height; @@ -1463,7 +1465,7 @@ new_width = new_width * factor; } - new_image = gdk_pixbuf_scale_simple(old_image, new_width, new_height, GDK_INTERP_BILINEAR); + new_image = gdk_pixbuf_scale_simple(image->pixbuf, new_width, new_height, GDK_INTERP_BILINEAR); gtk_image_set_from_pixbuf(image->image, new_image); g_object_unref(G_OBJECT(new_image)); } @@ -1472,9 +1474,8 @@ void gaim_im_image_free(GtkIMHtmlScalable *scale) { gaim_im_image *image = (gaim_im_image *)scale; -/* - g_object_unref(image->image); -*/ + + g_object_unref(image->pixbuf); g_free(image->filename); g_free(scale); } @@ -1587,7 +1588,7 @@ type = g_strdup("png"); } - gdk_pixbuf_save(gtk_image_get_pixbuf(image->image), filename, type, &error, NULL); + gdk_pixbuf_save(image->pixbuf, filename, type, &error, NULL); if(error){ gtk_message_dialog_new(NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,