diff options
author | Jorg Schuler <jcsjcs@users.sourceforge.net> | 2007-01-09 13:31:14 +0000 |
---|---|---|
committer | Jorg Schuler <jcsjcs@users.sourceforge.net> | 2007-01-09 13:31:14 +0000 |
commit | bf433d6b2225a8982526d0cc597d38b6c07d8047 (patch) | |
tree | 4881fc1d1d74423e92643d6ab976ba0b465254cd /src/ithumb-writer.c | |
parent | 7ec597989b41048ae917023b8b1f1f708e48459c (diff) | |
download | libgpod-bf433d6b2225a8982526d0cc597d38b6c07d8047.tar.gz libgpod-bf433d6b2225a8982526d0cc597d38b6c07d8047.tar.xz libgpod-bf433d6b2225a8982526d0cc597d38b6c07d8047.zip |
* src/pixmaps.c
src/pixmaps.h: New files containing last-resort pixmap in case
thumbnail/photo could not be added. Will not produce code
if the gdk-pixubf library is not present.
* src/ithumb-writer.c: use above pixmap instead of red canvas.
* src/Makefile.am: added pixmaps.[ch]
git-svn-id: https://gtkpod.svn.sf.net/svnroot/gtkpod/libgpod/trunk@1352 f01d2545-417e-4e96-918e-98f8d0dbbcb6
Diffstat (limited to 'src/ithumb-writer.c')
-rw-r--r-- | src/ithumb-writer.c | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/src/ithumb-writer.c b/src/ithumb-writer.c index 6de41b1..6bbb5c3 100644 --- a/src/ithumb-writer.c +++ b/src/ithumb-writer.c @@ -1,4 +1,4 @@ -/* Time-stamp: <2006-11-26 23:30:08 jcs> +/* Time-stamp: <2007-01-09 22:00:03 jcs> * * Copyright (C) 2005 Christophe Fergeau * @@ -34,11 +34,11 @@ #include "itdb_private.h" #include "itdb_endianness.h" +#include "pixmaps.h" #include <errno.h> #include <locale.h> #include <string.h> -#include <gdk-pixbuf/gdk-pixbuf.h> #include <unistd.h> #include <sys/types.h> @@ -359,10 +359,29 @@ ithumb_writer_write_thumbnail (iThumbWriter *writer, if (pixbuf == NULL) { /* This is quite bad... if we just return FALSE the ArtworkDB - gets messed up. For now let's insert a red thumbnail until - someone comes up with a "broken thumbnail" design */ - pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, width, height); - gdk_pixbuf_fill (pixbuf, 0xff000000); + gets messed up. */ + pixbuf = gdk_pixbuf_from_pixdata (&questionmark_pixdata, FALSE, NULL); + + if (pixbuf) + { + GdkPixbuf *pixbuf2; + pixbuf2 = gdk_pixbuf_scale_simple (pixbuf, + writer->img_info->width, + writer->img_info->height, + GDK_INTERP_BILINEAR); + g_object_unref (pixbuf); + pixbuf = pixbuf2; + } + else + { + /* Somethin went wrong. let's insert a red thumbnail */ + pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, + writer->img_info->width, + writer->img_info->height); + gdk_pixbuf_fill (pixbuf, 0xff000000); + } + /* avoid rotation */ + thumb->rotation = 0; } /* Rotate if necessary */ |