[Mplayer-cvslog] CVS: main/Gui bitmap.c,1.10,1.11 bitmap.h,1.7,1.8

Alex Beregszaszi alex at mplayerhq.hu
Fri May 23 19:04:50 CEST 2003


Update of /cvsroot/mplayer/main/Gui
In directory mail:/var/tmp.root/cvs-serv20709

Modified Files:
	bitmap.c bitmap.h 
Log Message:
some fixes and bigendian fix for 32bpp pngs

Index: bitmap.c
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/bitmap.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- bitmap.c	2 Nov 2002 17:07:18 -0000	1.10
+++ bitmap.c	23 May 2003 17:04:24 -0000	1.11
@@ -1,4 +1,3 @@
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -164,7 +163,7 @@
   }
  for ( i=0;i<2;i++ )
   {
-   sprintf( tmp,"%s%s",fname,ext[i] );
+   snprintf( tmp,511,"%s%s",fname,ext[i] );
    fl=fopen( tmp,"rb" );
    if ( fl != NULL )
     {
@@ -186,9 +185,13 @@
   }
  if ( bf->BPP < 24 )
   {
-   mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[bitmap] sorry, 16 or less bitmaps not supported.\n" );
+   mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[bitmap] Sorry, only 24 and 32 bpp bitmaps are supported.\n" );
    return -1;
   }
+#ifdef WORDS_BIGENDIAN
+ if (bf->BPP == 32)
+    swab(bf->Image, bf->Image, bf->ImageSize);
+#endif
  if ( conv24to32( bf ) ) return -8;
  bgr2rgb( bf );
  Normalize( bf );
@@ -203,7 +206,7 @@
  out->ImageSize=(out->Width * out->Height + 7) / 8;
  mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[c1to32] imagesize: %d\n",out->ImageSize );
  out->Image=(char *)calloc( 1,out->ImageSize );
- if ( out->Image == NULL ) mp_msg( MSGT_GPLAYER,MSGL_STATUS,"nem van ram baze\n" );
+ if ( out->Image == NULL ) mp_msg( MSGT_GPLAYER,MSGL_STATUS,"[c32to1] Not enough memory for image.\n" );
  {
   int i,b,c=0; unsigned int * buf = NULL; unsigned char tmp = 0; int nothaveshape = 1;
   buf=(unsigned int *)in->Image;
@@ -227,7 +230,7 @@
  out->ImageSize=out->Width * out->Height * 4;
  out->Image=(char *)calloc( 1,out->ImageSize );
  mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[c32to1] imagesize: %d\n",out->ImageSize );
- if ( out->Image == NULL ) mp_msg( MSGT_GPLAYER,MSGL_STATUS,"nem van ram baze\n" );
+ if ( out->Image == NULL ) mp_msg( MSGT_GPLAYER,MSGL_STATUS,"[c1to32] Not enough memory for image.\n" );
  {
   int i,b,c=0; unsigned int * buf = NULL; unsigned char tmp = 0;
   buf=(unsigned int *)out->Image;

Index: bitmap.h
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/bitmap.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- bitmap.h	1 Feb 2003 08:42:50 -0000	1.7
+++ bitmap.h	23 May 2003 17:04:24 -0000	1.8
@@ -1,5 +1,5 @@
-#ifndef __MYSAMPLE
-#define __MYSAMPLE
+#ifndef __BITMAP_H
+#define __BITMAP_H
 
 typedef struct _txSample
 {
@@ -15,4 +15,4 @@
 extern void Convert32to1( txSample * in,txSample * out,int adaptivlimit );
 extern void Convert1to32( txSample * in,txSample * out );
 
-#endif
+#endif /* __BITMAP_H */



More information about the MPlayer-cvslog mailing list