Update of /cvsroot/gtkpod/libgpod/src
In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv7233/src

Modified Files:
        Makefile.am ithumb-writer.c 
Added Files:
        pixmaps.c pixmaps.h 
Log Message:
        * 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]



--- NEW FILE: pixmaps.c ---
/* Time-stamp: <2007-01-09 22:04:32 jcs>
|
|  Copyright (C) 2002-2006 Jorg Schuler <jcsjcs at users sourceforge net>
|  Part of the gtkpod project.
| 
|  URL: http://www.gtkpod.org/
|  URL: http://gtkpod.sourceforge.net/
|
|  Most of the code in this file has been ported from the perl
|  script "mktunes.pl" (part of the gnupod-tools collection) written
|  by Adrian Ulrich <pab at blinkenlights.ch>.
|
|  gnupod-tools: http://www.blinkenlights.ch/cgi-bin/fm.pl?get=ipod
|
|  The code contained in this file is free software; you can redistribute
|  it and/or modify it under the terms of the GNU Lesser General Public
|  License as published by the Free Software Foundation; either version
|  2.1 of the License, or (at your option) any later version.
|
[...4059 lines suppressed...]
  "\377\377\377\376\377\377\377\377\377\376\377\377\377\377\377\376\377"
  "\377\377\377\377\376\377\377\377\377\377\376\377\377\377\377\377\376"
  "\377\377\377\377\377\376\377\377\377\377\377\376\377\377\377\377\377"
  "\376\377\377\377\377\377\376\377\377\377\377\377\376\377\377\377\377"
  "\377\376\377\377\377\377\377\376\377\377\377\377\377\376\377\377\377"
  "\377\377\376\377\377\377\377\377\376\377\377\377\377\377\376\377\377"
  "\377\377\377\376\377\377\377\377\377\376\377\377\377\377\377\376\377"
  "\377\377\377\377\376\377\377\377\377\377\376\377\377\377\377\377\376"
  "\377\377\377\377\377\376\377\377\377\377\377\376\377\377\377\377\377"
  "\376\377\377\377\377\377\376\377\377\377\377\377\376\377\377\377\377"
  "\377\376\377\377\377\377\377\376\377\377\377\377\377\376\377\377\377"
  "\377\377\376\377\377\377\377\377\376\377\377\377\377\377\376\377\377"
  "\377\377\377\376\377\377\377\377\377\376\377\377\377\377\377\376\377"
  "\377\377\377\16\377\376\377\377\377\377\377\376\377\377\377\377\377\376"
  "\377\377\377\377\377\376\377\377\377\377\377\376\377\377\377\377\377"
  "\376\377\377\377\377\377\376\377\377\377\377",
};


#endif

--- NEW FILE: pixmaps.h ---
/* Time-stamp: <2007-01-09 21:59:28 jcs>
|
|  Copyright (C) 2002-2006 Jorg Schuler <jcsjcs at users sourceforge net>
|  Part of the gtkpod project.
| 
|  URL: http://www.gtkpod.org/
|  URL: http://gtkpod.sourceforge.net/
|
|  Most of the code in this file has been ported from the perl
|  script "mktunes.pl" (part of the gnupod-tools collection) written
|  by Adrian Ulrich <pab at blinkenlights.ch>.
|
|  gnupod-tools: http://www.blinkenlights.ch/cgi-bin/fm.pl?get=ipod
|
|  The code contained in this file is free software; you can redistribute
|  it and/or modify it under the terms of the GNU Lesser General Public
|  License as published by the Free Software Foundation; either version
|  2.1 of the License, or (at your option) any later version.
|
|  This file is distributed in the hope that it will be useful,
|  but WITHOUT ANY WARRANTY; without even the implied warranty of
|  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
|  Lesser General Public License for more details.
|
|  You should have received a copy of the GNU Lesser General Public
|  License along with this code; if not, write to the Free Software
|  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
|
|  iTunes and iPod are trademarks of Apple
|
|  This product is not supported/written/published by Apple!
|
|  $Id: pixmaps.h,v 1.1 2007/01/09 13:31:14 jcsjcs Exp $
*/

#ifndef __PIXMAPS_H__
#define __PIXMAPS_H__

#include "itdb.h"

#ifdef HAVE_GDKPIXBUF

#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gdk-pixbuf/gdk-pixdata.h>

extern G_GNUC_INTERNAL const GdkPixdata questionmark_pixdata;

#endif

#endif

Index: Makefile.am
===================================================================
RCS file: /cvsroot/gtkpod/libgpod/src/Makefile.am,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- Makefile.am 31 Oct 2006 14:14:09 -0000      1.14
+++ Makefile.am 9 Jan 2007 13:31:13 -0000       1.15
@@ -22,6 +22,8 @@
        itdb_device.c \
        itdb_device.h \
        itdb_endianness.h \
+       pixmaps.c \
+       pixmaps.h \
        glib-compat.h
 
 

Index: ithumb-writer.c
===================================================================
RCS file: /cvsroot/gtkpod/libgpod/src/ithumb-writer.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- ithumb-writer.c     26 Nov 2006 15:00:41 -0000      1.25
+++ ithumb-writer.c     9 Jan 2007 13:31:13 -0000       1.26
@@ -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 @@
     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 */


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
gtkpod-cvs2 mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2

Reply via email to