# HG changeset patch # User Richard Laager # Date 1130448979 0 # Node ID ff02464a079f4c80b1b76a11b19293d8f0b5b6d2 # Parent 2bee8d023e231d52225e4567a8737060b32bfa78 [gaim-migrate @ 14158] SF Patch #1339095 from sadrul "This patch resizes images in GtkIMHtml that had previously been resized to a smaller size." This fixes the image resizing bug I had with maximizing Get Info windows. committer: Tailor Script diff -r 2bee8d023e23 -r ff02464a079f src/gtkimhtml.c --- a/src/gtkimhtml.c Thu Oct 27 21:30:22 2005 +0000 +++ b/src/gtkimhtml.c Thu Oct 27 21:36:19 2005 +0000 @@ -3150,23 +3150,30 @@ void gtk_imhtml_image_scale(GtkIMHtmlScalable *scale, int width, int height) { - GtkIMHtmlImage *image = (GtkIMHtmlImage *)scale; - - if(image->width > width || image->height > height){ + GtkIMHtmlImage *im_image = (GtkIMHtmlImage *)scale; + + if (im_image->width > width || im_image->height > height) { double ratio_w, ratio_h, ratio; int new_h, new_w; GdkPixbuf *new_image = NULL; - ratio_w = ((double)width - 2) / image->width; - ratio_h = ((double)height - 2) / image->height; + ratio_w = ((double)width - 2) / im_image->width; + ratio_h = ((double)height - 2) / im_image->height; ratio = (ratio_w < ratio_h) ? ratio_w : ratio_h; - new_w = (int)(image->width * ratio); - new_h = (int)(image->height * ratio); - - new_image = gdk_pixbuf_scale_simple(image->pixbuf, new_w, new_h, GDK_INTERP_BILINEAR); - gtk_image_set_from_pixbuf(image->image, new_image); + new_w = (int)(im_image->width * ratio); + new_h = (int)(im_image->height * ratio); + + new_image = gdk_pixbuf_scale_simple(im_image->pixbuf, new_w, new_h, GDK_INTERP_BILINEAR); + gtk_image_set_from_pixbuf(im_image->image, new_image); + g_object_unref(G_OBJECT(new_image)); + } else if (gdk_pixbuf_get_width(gtk_image_get_pixbuf(im_image->image)) != im_image->width) { + /* Enough space to show the full-size of the image. */ + GdkPixbuf *new_image; + + new_image = gdk_pixbuf_scale_simple(im_image->pixbuf, im_image->width, im_image->height, GDK_INTERP_BILINEAR); + gtk_image_set_from_pixbuf(im_image->image, new_image); g_object_unref(G_OBJECT(new_image)); } }