summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorteuf <teuf@f01d2545-417e-4e96-918e-98f8d0dbbcb6>2008-07-06 09:42:07 +0000
committerteuf <teuf@f01d2545-417e-4e96-918e-98f8d0dbbcb6>2008-07-06 09:42:07 +0000
commitd12208b30fe99cd3ed1d6c4a5b8cddb9ad36653a (patch)
treeed995899f5e42d12a1d7511ecb62a99a84389294
parent4c0222840c33ff472e07695ea7e159df8202392d (diff)
downloadlibgpod-d12208b30fe99cd3ed1d6c4a5b8cddb9ad36653a.tar.gz
libgpod-d12208b30fe99cd3ed1d6c4a5b8cddb9ad36653a.tar.xz
libgpod-d12208b30fe99cd3ed1d6c4a5b8cddb9ad36653a.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--ChangeLog6
-rw-r--r--src/ithumb-writer.c41
2 files changed, 27 insertions, 20 deletions
diff --git a/ChangeLog b/ChangeLog
index e3d10dc..fc7e6fe 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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 *