summaryrefslogtreecommitdiffstats
path: root/Gui
diff options
context:
space:
mode:
authoralex <alex@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-05-23 17:04:24 +0000
committeralex <alex@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-05-23 17:04:24 +0000
commit13d89cd03d6d74967205ad1d81f03b93db246ff6 (patch)
tree824cfcb7db2798a6951903a5dc5396d6b974b0f9 /Gui
parentd9beced7e677d7c394bb9d30f3f2803309ba04c6 (diff)
downloadmpv-13d89cd03d6d74967205ad1d81f03b93db246ff6.tar.bz2
mpv-13d89cd03d6d74967205ad1d81f03b93db246ff6.tar.xz
some fixes and bigendian fix for 32bpp pngs
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@10169 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'Gui')
-rw-r--r--Gui/bitmap.c13
-rw-r--r--Gui/bitmap.h6
2 files changed, 11 insertions, 8 deletions
diff --git a/Gui/bitmap.c b/Gui/bitmap.c
index afb20d1d2c..9efc27d491 100644
--- a/Gui/bitmap.c
+++ b/Gui/bitmap.c
@@ -1,4 +1,3 @@
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -164,7 +163,7 @@ unsigned char * fExist( unsigned char * fname )
}
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 @@ int bpRead( char * fname, txSample * bf )
}
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 @@ void Convert32to1( txSample * in,txSample * out,int adaptivlimit )
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 @@ void Convert1to32( txSample * in,txSample * out )
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;
diff --git a/Gui/bitmap.h b/Gui/bitmap.h
index ce8bbaed3c..5b4075a7e7 100644
--- a/Gui/bitmap.h
+++ b/Gui/bitmap.h
@@ -1,5 +1,5 @@
-#ifndef __MYSAMPLE
-#define __MYSAMPLE
+#ifndef __BITMAP_H
+#define __BITMAP_H
typedef struct _txSample
{
@@ -15,4 +15,4 @@ extern int conv24to32( txSample * bf );
extern void Convert32to1( txSample * in,txSample * out,int adaptivlimit );
extern void Convert1to32( txSample * in,txSample * out );
-#endif
+#endif /* __BITMAP_H */