[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdebase/workspace/ksplash/ksplashx
From:       Luboš Luňák <l.lunak () kde ! org>
Date:       2010-06-21 16:52:48
Message-ID: 20100621170052.C95E6AC8DA () svn ! kde ! org
[Download RAW message or body]

SVN commit 1140849 by lunakl:

add the qt3 jpeg loader too, it's dumb to have a separate .png
for the background image



 M  +3 -1      CMakeLists.txt  
 M  +1 -1      README  
 M  +0 -1      defs.h  
 M  +1 -0      pixmap.h  
 A             qjpegio.cpp   [License: GPL (v2+)]
 M  +14 -2     splash.cpp  


--- trunk/KDE/kdebase/workspace/ksplash/ksplashx/CMakeLists.txt #1140848:1140849
@@ -5,6 +5,7 @@
 add_subdirectory( themes )
 
 include( FindPNG )
+include( FindJPEG )
 
 include_directories(${PNG_PNG_INCLUDE_DIR})
 
@@ -19,6 +20,7 @@
 set( ksplashx_SRCS
     main.cpp
     qglobal.cpp
+    qjpegio.cpp
     qpngio.cpp
     qimage.cpp
     qsize.cpp
@@ -46,7 +48,7 @@
 endif( X86_MMX_FOUND2 )
 
 add_executable( ksplashx ${ksplashx_SRCS} ${ksplashx_EXTRA_SRCS} )
-target_link_libraries( ksplashx ${X11_LIBRARIES} ${PNG_LIBRARIES})
+target_link_libraries( ksplashx ${X11_LIBRARIES} ${PNG_LIBRARIES} ${JPEG_LIBRARIES})
 if( X11_Xinerama_FOUND )
     target_link_libraries( ksplashx ${X11_Xinerama_LIB} )
 endif( X11_Xinerama_FOUND )
--- trunk/KDE/kdebase/workspace/ksplash/ksplashx/README #1140848:1140849
@@ -1,4 +1,4 @@
-This is a splashscreen which basically depends only on libX11 and libpng.
+This is a splashscreen which basically depends only on libX11, libpng and libjpeg.
 It includes few sources from Qt which have been modified to work without
 QApplication. Due to almost no link dependencies and no QApplication
 initialization this splashscreen has a very fast startup.
--- trunk/KDE/kdebase/workspace/ksplash/ksplashx/defs.h #1140848:1140849
@@ -74,7 +74,6 @@
 #define QT_NO_IMAGEIO_XBM
 #define QT_NO_IMAGEIO_XPM
 #define QT_NO_IMAGEIO_MNG
-#define QT_NO_IMAGEIO_JPEG
 #define QT_NO_ASYNC_IMAGE_IO
 
 #define QT_STATIC_CONST static const
--- trunk/KDE/kdebase/workspace/ksplash/ksplashx/pixmap.h #1140848:1140849
@@ -77,5 +77,6 @@
     }
 
 QImage splash_read_png_image(FILE* f);
+QImage splash_read_jpeg_image(FILE* f);
 
 #endif
--- trunk/KDE/kdebase/workspace/ksplash/ksplashx/splash.cpp #1140848:1140849
@@ -170,6 +170,7 @@
                         {
                         best_w = w;
                         best_h = h;
+                        best_distance = distance;
                         strcpy( best, tmp );
                         }
                     }
@@ -346,6 +347,17 @@
         }
     }
 
+static QImage readImage( FILE* f )
+    {
+    const char jpeg[ 3 + 1 ] = "\377\330\377";
+    char buf[ 3 ] = "";
+    fread( buf, 1, 3, f );
+    rewind( f );
+    if( memcmp( buf, jpeg, 3 ) == 0 )
+        return splash_read_jpeg_image( f );
+    return splash_read_png_image( f );
+    }
+
 static QImage loadImage( const char* file, QRect geom )
     {
     int w, h;
@@ -354,7 +366,7 @@
     FILE* f = fopen( real_file, "r" );
     if( f == NULL )
         return QImage();
-    QImage img = splash_read_png_image( f );
+    QImage img = readImage( f );
     if( img.depth() != 32 )
         img = img.convertDepth( 32 );
     fclose( f );
@@ -407,7 +419,7 @@
         fprintf( stderr, "Bad anim file: %s\n", file );
         exit( 3 );
         }
-    QImage img = splash_read_png_image( f );
+    QImage img = readImage( f );
     if( img.depth() != 32 )
         img = img.convertDepth( 32 );
     fclose( f );
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic