summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Fergeau <teuf@gnome.org>2008-11-17 19:56:43 +0000
committerChristophe Fergeau <teuf@gnome.org>2008-11-17 19:56:43 +0000
commit4f88927b3323b947f5804f6b6f9870f2d7b679c6 (patch)
tree230ae29ca9f41420c3d8ebd50bc0a08c5b93a516
parent870d5f2511fa58c19f9464e62d8972022f5953b1 (diff)
downloadlibgpod-4f88927b3323b947f5804f6b6f9870f2d7b679c6.tar.gz
libgpod-4f88927b3323b947f5804f6b6f9870f2d7b679c6.tar.xz
libgpod-4f88927b3323b947f5804f6b6f9870f2d7b679c6.zip
Attempt at fixing an artwork display bug on the nano4g
git-svn-id: https://gtkpod.svn.sf.net/svnroot/gtkpod/libgpod/trunk@2153 f01d2545-417e-4e96-918e-98f8d0dbbcb6
-rw-r--r--ChangeLog7
-rw-r--r--src/ithumb-writer.c23
2 files changed, 23 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 452ae87..1caa056 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2008-11-17 Christophe Fergeau <teuf@gnome.org>
+ * src/ithumb-writer.c: rework the way we calculate that thumbnails
+ must be resized to when being transferred to the ipod. The old way
+ had rounding errors which led to display bugs on the nano4g (in the
+ album list)
+
+2008-11-17 Christophe Fergeau <teuf@gnome.org>
+
* src/ithumb-writer.c: stricter sanity check
2008-11-17 Christophe Fergeau <teuf@gnome.org>
diff --git a/src/ithumb-writer.c b/src/ithumb-writer.c
index 3c22268..c29151e 100644
--- a/src/ithumb-writer.c
+++ b/src/ithumb-writer.c
@@ -791,13 +791,22 @@ ithumb_writer_scale_and_crop (GdkPixbuf *input_pixbuf,
if (!crop)
{
- /* If we're not cropping, we need to be able to fit both the whole width
- and whole height, so we use the smaller of the two possible scale
- factors. */
- scale = MIN(width_scale, height_scale);
- offset_x = offset_y = 0;
- return gdk_pixbuf_scale_simple (input_pixbuf,
- input_width*scale, input_height*scale,
+ guint scaled_height;
+ guint scaled_width;
+
+ if (width_scale < height_scale) {
+ scaled_width = width;
+ scaled_height = MIN (ceil (input_height*width_scale), height);
+ } else if (width_scale > height_scale) {
+ scaled_width =MIN (ceil (input_width*height), width);
+ scaled_height = height;
+ } else {
+ scaled_width = width;
+ scaled_height = height;
+ }
+
+ return gdk_pixbuf_scale_simple (input_pixbuf,
+ scaled_width, scaled_height,
GDK_INTERP_BILINEAR);
} else {
double scaled_width, scaled_height;