diff options
author | Christophe Fergeau <teuf@gnome.org> | 2008-07-06 09:42:07 +0000 |
---|---|---|
committer | Christophe Fergeau <teuf@gnome.org> | 2008-07-06 09:42:07 +0000 |
commit | d629959f687e8ec0109f2295c66ae4ef00943d70 (patch) | |
tree | ed995899f5e42d12a1d7511ecb62a99a84389294 | |
parent | 2438b1c58c0b45e1f5fd20af7410821787b88396 (diff) | |
download | libgpod-tmz-d629959f687e8ec0109f2295c66ae4ef00943d70.tar.gz libgpod-tmz-d629959f687e8ec0109f2295c66ae4ef00943d70.tar.xz libgpod-tmz-d629959f687e8ec0109f2295c66ae4ef00943d70.zip |
Fix bug in thumbnail resizing when not cropping which caused duplicated lines at the bottom of thumbnails
git-svn-id: https://gtkpod.svn.sf.net/svnroot/gtkpod/libgpod/trunk@2036 f01d2545-417e-4e96-918e-98f8d0dbbcb6
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | src/ithumb-writer.c | 41 |
2 files changed, 27 insertions, 20 deletions
@@ -1,3 +1,9 @@ +2008-07-06 Christophe Fergeau <teuf@gnome.org> + + * src/ithumb-writer.c: fix bug in the function scaling and cropping + thumbnails, in the non-cropping case, the returned pixbuf size + didn't reflect the size of the scaled pixbuf + 2008-07-05 Christophe Fergeau <teuf@gnome.org> * src/db-artwork-parser.c: fix small memory leak diff --git a/src/ithumb-writer.c b/src/ithumb-writer.c index 1f57b93..95d4a3d 100644 --- a/src/ithumb-writer.c +++ b/src/ithumb-writer.c @@ -772,9 +772,10 @@ ithumb_writer_scale_and_crop (GdkPixbuf *input_pixbuf, factors. */ scale = MIN(width_scale, height_scale); offset_x = offset_y = 0; - } - else - { + return gdk_pixbuf_scale_simple (input_pixbuf, + input_width*scale, input_height*scale, + GDK_INTERP_BILINEAR); + } else { double scaled_width, scaled_height; /* If we are cropping, we use the max of the two possible scale factors, so that the image is large enough to fill both dimensions. */ @@ -791,24 +792,24 @@ ithumb_writer_scale_and_crop (GdkPixbuf *input_pixbuf, offset_y = round((height - scaled_height) / 2); g_assert(round(scaled_width) == width || - round(scaled_height) == height); + round(scaled_height) == height); + + output_pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8, + width + border_width, + height + border_width); + gdk_pixbuf_fill(output_pixbuf, 0xffffffff); + + gdk_pixbuf_scale (input_pixbuf, + output_pixbuf, + 0, 0, /* dest x, dest y */ + width, /* dest width */ + height, /* dest height */ + offset_x, offset_y, /* offset x, offset y */ + scale, scale, /* scale x, scale y */ + GDK_INTERP_BILINEAR); + + return output_pixbuf; } - - output_pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8, - width + border_width, - height + border_width); - gdk_pixbuf_fill(output_pixbuf, 0xffffffff); - - gdk_pixbuf_scale (input_pixbuf, - output_pixbuf, - 0, 0, /* dest x, dest y */ - width, /* dest width */ - height, /* dest height */ - offset_x, offset_y, /* offset x, offset y */ - scale, scale, /* scale x, scale y */ - GDK_INTERP_BILINEAR); - - return output_pixbuf; } static GdkPixbuf * |