[Mplayer-cvslog] CVS: main/Gui/bitmap bitmap.c,1.2,1.3 bitmap.h,1.2,1.3
Zoltan Ponekker
pontscho at mplayer.dev.hu
Mon Nov 5 18:00:44 CET 2001
Update of /cvsroot/mplayer/main/Gui/bitmap
In directory mplayer:/var/tmp.root/cvs-serv948/Gui/bitmap
Modified Files:
bitmap.c bitmap.h
Log Message:
fix small xshape bug
Index: bitmap.c
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/bitmap/bitmap.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- bitmap.c 4 Oct 2001 18:29:42 -0000 1.2
+++ bitmap.c 5 Nov 2001 17:00:27 -0000 1.3
@@ -173,3 +173,52 @@
Normalize( bf );
return 0;
}
+
+void Convert32to1( txSample * in,txSample * out,int adaptivlimit )
+{
+ out->Width=in->Width;
+ out->Height=in->Height;
+ out->BPP=1;
+ out->ImageSize=out->Width * out->Height / 8;
+ dbprintf( 4,"[c1to32] imagesize: %d\n",out->ImageSize );
+ out->Image=(char *)calloc( 1,out->ImageSize );
+ if ( out->Image == NULL ) dbprintf( 4,"nem van ram baze\n" );
+ {
+ int i,b,c=0; unsigned long * buf = NULL; unsigned char tmp = 0; int nothaveshape = 1;
+ buf=(unsigned long *)in->Image;
+ for ( b=0,i=0;i < out->Width * out->Height;i++ )
+ {
+ if ( buf[i] != adaptivlimit ) tmp=( tmp >> 1 )|128;
+ else { tmp=tmp >> 1; buf[i]=nothaveshape=0; }
+ if ( b++ == 7 ) { out->Image[c++]=tmp; tmp=b=0; }
+ }
+ if ( b ) out->Image[c]=tmp;
+ if ( nothaveshape ) { free( out->Image ); out->Image=NULL; }
+ }
+}
+
+void Convert1to32( txSample * in,txSample * out )
+{
+ if ( in->Image == NULL ) return;
+ out->Width=in->Width;
+ out->Height=in->Height;
+ out->BPP=32;
+ out->ImageSize=out->Width * out->Height * 4;
+ out->Image=(char *)calloc( 1,out->ImageSize );
+ dbprintf( 4,"[c32to1] imagesize: %d\n",out->ImageSize );
+ if ( out->Image == NULL ) dbprintf( 4,"nem van ram baze\n" );
+ {
+ int i,b,c=0; unsigned long * buf = NULL; unsigned char tmp = 0;
+ buf=(unsigned long *)out->Image;
+ for ( c=0,i=0;i < in->Width * in->Height / 8;i++ )
+ {
+ tmp=in->Image[i];
+ for ( b=0;b<8;b++ )
+ {
+ buf[c]=0;
+ if ( tmp&0x1 ) buf[c]=0xffffffff;
+ c++; tmp=tmp>>1;
+ }
+ }
+ }
+}
Index: bitmap.h
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/bitmap/bitmap.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- bitmap.h 27 Sep 2001 17:40:42 -0000 1.2
+++ bitmap.h 5 Nov 2001 17:00:27 -0000 1.3
@@ -17,5 +17,7 @@
extern int bpRead( char * fname, txSample * bf );
extern int conv24to32( txSample * bf );
+extern void Convert32to1( txSample * in,txSample * out,int adaptivlimit );
+extern void Convert1to32( txSample * in,txSample * out );
#endif
More information about the MPlayer-cvslog
mailing list