ooo-build r13993 - in branches/ooo-build-3-0: . patches/dev300



Author: jholesovsky
Date: Mon Sep 22 10:57:47 2008
New Revision: 13993
URL: http://svn.gnome.org/viewvc/ooo-build?rev=13993&view=rev

Log:
2008-09-22  Jan Holesovsky  <kendy suse cz>

        * patches/dev300/unxsplash-bmp-alias.diff,
          patches/dev300/apply: Fix bitmap reading - the lines are aliased to
          4 bytes.


Added:
   branches/ooo-build-3-0/patches/dev300/unxsplash-bmp-alias.diff
Modified:
   branches/ooo-build-3-0/ChangeLog
   branches/ooo-build-3-0/patches/dev300/apply

Modified: branches/ooo-build-3-0/patches/dev300/apply
==============================================================================
--- branches/ooo-build-3-0/patches/dev300/apply	(original)
+++ branches/ooo-build-3-0/patches/dev300/apply	Mon Sep 22 10:57:47 2008
@@ -601,6 +601,9 @@
 # the OSL_PIPE protocol has changed thanks to 3-layer OOo again :-(
 unxsplash-3layer.diff, i#60696, jholesov
 
+# fix bitmap reading; the lines are aliased to 4 bytes
+unxsplash-bmp-alias.diff, i#60696, jholesov
+
 
 [ WriterFixes ]
 # Allows to copy/paste html text which is between 2 unknown tags.

Added: branches/ooo-build-3-0/patches/dev300/unxsplash-bmp-alias.diff
==============================================================================
--- (empty file)
+++ branches/ooo-build-3-0/patches/dev300/unxsplash-bmp-alias.diff	Mon Sep 22 10:57:47 2008
@@ -0,0 +1,72 @@
+diff --git desktop/unx/source/splashx.c desktop/unx/source/splashx.c
+index b3b6da0..c792cc0 100644
+--- desktop/unx/source/splashx.c
++++ desktop/unx/source/splashx.c
+@@ -65,6 +65,7 @@ static Visual *visual = NULL;
+ 
+ static int width = WINDOW_WIDTH;
+ static int height = WINDOW_HEIGHT;
++static int alias = 0;
+ 
+ static Colormap color_map;
+ static Window win;
+@@ -83,7 +84,7 @@ static color_t framecol = { 0xD3, 0xD3, 0xD3 };
+ static XColor barcolor;
+ static XColor framecolor;
+ 
+-static color_t *bitmap = NULL;
++static char *bitmap = NULL;
+ 
+ #define BMP_HEADER_LEN 14
+ #define WIN_INFO_LEN 40
+@@ -120,7 +121,7 @@ int splash_load_bmp( char *filename )
+     if ( read( fd, file_header, BMP_HEADER_LEN ) != BMP_HEADER_LEN || file_header[0] != 'B' || file_header[1] != 'M' )
+         LOAD_FAILURE( "Not a bitmap.\n" );
+ 
+-    int file_size = UINT32( file_header + 2 );
++    //int file_size = UINT32( file_header + 2 );
+ 
+     char info_header[ WIN_INFO_LEN ];
+     if ( read( fd, info_header, 4 ) != 4 )
+@@ -135,6 +136,7 @@ int splash_load_bmp( char *filename )
+ 
+     width = UINT32( info_header + 4 );
+     height = UINT32( info_header + 8 );
++    alias = width % 4;
+ 
+     int bits = UINT16( info_header + 14 );
+     int compression = UINT16( info_header + 16 );
+@@ -145,7 +147,7 @@ int splash_load_bmp( char *filename )
+     if ( compression != 0 )
+         LOAD_FAILURE( "Just uncompressed bitmaps are supported.\n" );
+ 
+-    size_t bitmap_size = width * height * 3;
++    ssize_t bitmap_size = width * height * 3 + alias * height;
+     bitmap = malloc( bitmap_size );
+     if ( bitmap == NULL )
+         LOAD_FAILURE( "Cannot allocate memory for the data.\n" );
+@@ -280,6 +282,7 @@ static void create_pixmap()
+             for ( y = 0; y < height; ++y ) \
+             { \
+                 unsigned long red_delta = 0, green_delta = 0, blue_delta = 0; \
++                color_t *in = (color_t *)( bitmap + y * ( width * 3 + alias ) ); \
+                 for ( x = 0; x < width; ++x, ++in  ) \
+                 { \
+                     unsigned long red   = in->r + red_delta; \
+@@ -304,7 +307,6 @@ static void create_pixmap()
+             } \
+         }
+ 
+-        color_t *in = bitmap;
+         char *out = data;
+ 
+         if ( bpp == 32 )
+@@ -371,7 +373,7 @@ static void create_pixmap()
+         int x, y;
+         for ( y = 0; y < height; ++y )
+         {
+-            color_t *color = bitmap + y * width;
++            color_t *color = (color_t *)( bitmap + y * ( width * 3 + alias ) );
+ 
+             int delta = 0;
+             for ( x = 0; x < width; ++x, ++color )



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]