[maemo-commits] [maemo-commits] r12609 - in projects/haf/trunk/hildon-help: . debian src

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Mon Jul 2 18:27:52 EEST 2007
Author: schulhof
Date: 2007-07-02 18:27:37 +0300 (Mon, 02 Jul 2007)
New Revision: 12609

Modified:
   projects/haf/trunk/hildon-help/ChangeLog
   projects/haf/trunk/hildon-help/configure.ac
   projects/haf/trunk/hildon-help/debian/changelog
   projects/haf/trunk/hildon-help/debian/control
   projects/haf/trunk/hildon-help/src/Makefile.am
   projects/haf/trunk/hildon-help/src/graphic.c
Log:
  * Remove direct dependency on libpng and libjpeg via gdk_pixbuf_get_file_info()
  * Patch from Tommi Komulainen


Modified: projects/haf/trunk/hildon-help/ChangeLog
===================================================================
--- projects/haf/trunk/hildon-help/ChangeLog	2007-07-02 14:58:55 UTC (rev 12608)
+++ projects/haf/trunk/hildon-help/ChangeLog	2007-07-02 15:27:37 UTC (rev 12609)
@@ -1,7 +1,12 @@
+2007-07-02 Gabriel Schulhof <gabriel.schulhof at nokia.com>
+
+	* Remove direct dependency on libpng and libjpeg via gdk_pixbuf_get_file_info()
+	* Patch from Tommi Komulainen
+
 2007-06-28 Gabriel Schulhof <gabriel.schulhof at nokia.com>
 
-  * Stop eating client messages
-  * Fixes: NB#61917
+	* Stop eating client messages
+	* Fixes: NB#61917
 
 2007-05-31 Gabriel Schulhof <gabriel.schulhof at nokia.com>
 

Modified: projects/haf/trunk/hildon-help/configure.ac
===================================================================
--- projects/haf/trunk/hildon-help/configure.ac	2007-07-02 14:58:55 UTC (rev 12608)
+++ projects/haf/trunk/hildon-help/configure.ac	2007-07-02 15:27:37 UTC (rev 12609)
@@ -7,7 +7,7 @@
 
 # Mandatory, initializes autoconf.
 #
-AC_INIT(libhildonhelp, 1.9.2)
+AC_INIT(libhildonhelp, 1.9.3)
 
 # Tests that source dir exists
 AC_CONFIG_SRCDIR(src/hildon-help.h)
@@ -37,20 +37,11 @@
     glib-2.0 >= 2.6
     hildon-1 >= 1.0.0
     libosso >= 1.0.0
-    libpng
     libgtkhtml-3.8
 )
 AC_SUBST( DEPS_CFLAGS )
 AC_SUBST( DEPS_LIBS )
 
-AC_CHECK_LIB([jpeg], [jpeg_read_header], [have_jpeg="yes"], [have_jpeg="no"])
-if test x$have_jpeg = xyes;then
-    JPEG_LIBS="-ljpeg"
-else
-    AC_ERROR([Library libjpeg not found.])
-fi
-AC_SUBST( JPEG_LIBS )
-
 # Localisation-related
 #
 GETTEXT_PACKAGE=osso-help

Modified: projects/haf/trunk/hildon-help/debian/changelog
===================================================================
--- projects/haf/trunk/hildon-help/debian/changelog	2007-07-02 14:58:55 UTC (rev 12608)
+++ projects/haf/trunk/hildon-help/debian/changelog	2007-07-02 15:27:37 UTC (rev 12609)
@@ -1,3 +1,10 @@
+libhildonhelp (1.9.3-1) unstable; urgency=low
+
+  * Remove direct dependency on libpng and libjpeg via gdk_pixbuf_get_file_info()
+  * Patch from Tommi Komulainen
+
+ -- Gabriel Schulhof <gabriel.schulhof at nokia.com>  Mon,  2 Jul 2007 15:51:35 +0300
+
 libhildonhelp (1.9.2-1) unstable; urgency=low
 
   * Stop eating client messages

Modified: projects/haf/trunk/hildon-help/debian/control
===================================================================
--- projects/haf/trunk/hildon-help/debian/control	2007-07-02 14:58:55 UTC (rev 12608)
+++ projects/haf/trunk/hildon-help/debian/control	2007-07-02 15:27:37 UTC (rev 12609)
@@ -2,7 +2,7 @@
 Section: misc
 Priority: optional
 Maintainer: Gabriel Schulhof <gabriel.schulhof at nokia.com>
-Build-Depends: debhelper (>= 4.0.0), libgtk2.0-dev (>= 2.6.0-1), pkg-config, libosso-dev, libhildon1-dev (>= 0.9.9-3), intltool (>= 0.21), autoconf, automake1.7, libtool, gtkhtml-dev (>= 3.9.1), libpng12-dev, libjpeg62-dev, libxml2-dev
+Build-Depends: debhelper (>= 4.0.0), libgtk2.0-dev (>= 2.6.0-1), pkg-config, libosso-dev, libhildon1-dev (>= 0.9.9-3), intltool (>= 0.21), autoconf, automake1.7, libtool, gtkhtml-dev (>= 3.9.1), libxml2-dev
 Standards-Version: 3.6.1
 
 Package: libhildonhelp-dev

Modified: projects/haf/trunk/hildon-help/src/Makefile.am
===================================================================
--- projects/haf/trunk/hildon-help/src/Makefile.am	2007-07-02 14:58:55 UTC (rev 12608)
+++ projects/haf/trunk/hildon-help/src/Makefile.am	2007-07-02 15:27:37 UTC (rev 12609)
@@ -25,7 +25,7 @@
 # Added to allow prelinkage
 # Changed to '_LIBADD'
 #
-libhildonhelp_la_LDFLAGS=@DEPS_LIBS@ @JPEG_LIBS@
+libhildonhelp_la_LDFLAGS=@DEPS_LIBS@
 #libhildonhelp_la_LIBADD=$(DEPS_LIBS)
 
 libhildonhelp_la_includedir = $(includedir)/hildon-help/hildon

Modified: projects/haf/trunk/hildon-help/src/graphic.c
===================================================================
--- projects/haf/trunk/hildon-help/src/graphic.c	2007-07-02 14:58:55 UTC (rev 12608)
+++ projects/haf/trunk/hildon-help/src/graphic.c	2007-07-02 15:27:37 UTC (rev 12609)
@@ -26,10 +26,6 @@
 
 #include <gtk/gtk.h>
 
-#include <png.h>    /* libpng */
-#include <jpeglib.h> /* linjpeg */
-#include <setjmp.h>  /* Used for libjpeg error handling */
-
 /* Height limit for showing a pic in full size
  *
  * This should be around the size of 'normal' Help text in browser.
@@ -40,109 +36,6 @@
 /*---( HelpLib portion -- HTML conversion )---*/
 
 /**
-  Get the resolution (width & height) of a .PNG picture
-  
-  @param fn filename
-  @param wref reference to store the width
-  @param href reference to store the height
-  @return #TRUE for success
-*/
-static
-gboolean png_resolution( const char *fname, guint *wref, guint *href )
-{
-    gboolean ok= FALSE;
-    FILE *f;
-    
-    /* TBD: Could optimize this by keeping the 'png_p' and 'info_p'
-     *      structures alive (static), but it didn't seem to work
-     *      as expected.. So, for now they're made afresh each time.
-     */
-        
-    png_structp png_p=
-        png_create_read_struct( PNG_LIBPNG_VER_STRING, 
-                                NULL, NULL, NULL );
-    if (!png_p) {       
-        ULOG_DEBUG ("libPNG error: Unable to init 'png_p'!\n" );
-        return FALSE;
-    }
-
-    png_infop info_p= png_create_info_struct( png_p );
-    if (!info_p) {
-        png_destroy_read_struct( &png_p, NULL, NULL );
-        ULOG_DEBUG ("libPNG error: Unable to init 'info_p'!\n" );
-        return FALSE;
-    }
-
-    /* libPNG set up, let's see the file */
-    f= fopen( fname, "rb" );
-    if (f) {
-        /*void*/ png_init_io( png_p, f );
-        /*void*/ png_read_info( png_p, info_p );
-        
-        fclose(f), f=NULL;      /* we got what we wanted, thanks */
-        
-        if (wref) *wref= info_p->width;
-        if (href) *href= info_p->height;
-    
-        ok= TRUE;
-    }
-
-    png_destroy_read_struct( &png_p, &info_p, NULL );
-
-    return ok;  
-}
-
-
-static
-void jpeg_error_exit(j_common_ptr cinfo)
-{
-    /* Return control to the setjmp point */
-    longjmp(cinfo->client_data, 1);
-}
-
-static
-gboolean jpeg_resolution( const char *fname, guint *wref, guint *href )
-{
-    gboolean ok= FALSE;
-    FILE *f = NULL;
-    jmp_buf setjmp_buffer;
-    struct jpeg_decompress_struct cinfo;
-    struct jpeg_error_mgr jerr;
-
-    jpeg_create_decompress(&cinfo);
-    cinfo.err = jpeg_std_error(&jerr);
-    jerr.error_exit = jpeg_error_exit;
-    cinfo.client_data = (void *) &setjmp_buffer;
-
-    f= fopen( fname, "rb" );
-    if (setjmp(setjmp_buffer)) {
-        /* If we get here, the JPEG code has signaled an error and
-           we got here by the longjmp call in jpeg_error_exit */
-        /* Nothing is done here because destroying of jpeg data structure
-           and closing of file is doen in common code to successfull case */
-    }
-    else
-    {
-        /* This part is normally run */
-        if (f) {
-            jpeg_stdio_src(&cinfo, f);
-            jpeg_read_header(&cinfo, TRUE);
-
-            if (wref) *wref= cinfo.image_width;
-            if (href) *href= cinfo.image_height;
-
-            ok= TRUE;
-        }
-    }
-
-    jpeg_destroy_decompress(&cinfo);
-    fclose(f), f=NULL;
-
-    return ok;  
-}
-
-
-/**
   Write an HTML tag entry for an inline picture to 'buf'.
 
   Note: Picture is scaled to "browser default text size" (whichever that is)
@@ -163,29 +56,15 @@
      *
      * snprintf( buf, bufsize, "<img src=\"file://%s\"/>", fname );
      */
-    if (strstr( fname, ".png" )) {
-        ULOG_DEBUG ("PNG processing: %s\n", fname );
-
-        ok= png_resolution( fname, &w, &h );
-
-        if (ok) {
-          ULOG_DEBUG("PNG resolution: %dx%d\n", w, h );
-        } else {
-           ULOG_DEBUG ("PNG resolution: failed\n" );
-        }
+    ULOG_DEBUG ("processing: %s\n", fname );
+    ok = gdk_pixbuf_get_file_info (fname, &w, &h) != NULL;
+    if (ok) {
+	ULOG_DEBUG("resolution: %dx%d\n", w, h );
+    } else {
+	ULOG_DEBUG ("resolution: failed\n" );
+	w = h = 0;
     }
-    else if (strstr( fname, ".jpg" ) || strstr( fname, ".jpeg" )) {
-        ULOG_DEBUG ("JPEG processing: %s\n", fname );
 
-        ok= jpeg_resolution( fname, &w, &h );
-
-        if (ok) {
-          ULOG_DEBUG("JPEG resolution: %dx%d\n", w, h );
-        } else {
-           ULOG_DEBUG ("JPEG resolution: failed\n" );
-        }
-    }
-
     /* Force image height to 26 pixels */
     if (h != FORCED_IMAGE_HEIGHT) {
         w /= ((float)h) / (FORCED_IMAGE_HEIGHT);


More information about the maemo-commits mailing list