diff options
-rw-r--r-- | recordmydesktop/include/recordmydesktop.h | 2 | ||||
-rw-r--r-- | recordmydesktop/src/make_dummy_pointer.c | 28 |
2 files changed, 20 insertions, 10 deletions
diff --git a/recordmydesktop/include/recordmydesktop.h b/recordmydesktop/include/recordmydesktop.h index 6cf6534..77f0d78 100644 --- a/recordmydesktop/include/recordmydesktop.h +++ b/recordmydesktop/include/recordmydesktop.h @@ -61,10 +61,12 @@ //define whcih way we are reading a pixmap #if __BYTE_ORDER == __LITTLE_ENDIAN +#define __ABYTE 3 #define __RBYTE 2 #define __GBYTE 1 #define __BBYTE 0 #elif __BYTE_ORDER == __BIG_ENDIAN +#define __ABYTE 0 #define __RBYTE 1 #define __GBYTE 2 #define __BBYTE 3 diff --git a/recordmydesktop/src/make_dummy_pointer.c b/recordmydesktop/src/make_dummy_pointer.c index 0ab0306..7f6425f 100644 --- a/recordmydesktop/src/make_dummy_pointer.c +++ b/recordmydesktop/src/make_dummy_pointer.c @@ -29,8 +29,8 @@ unsigned char *MakeDummyPointer(DisplaySpecs *specs,int size,int color,int type,unsigned char *npxl){ int i,k,o='.'; - unsigned long w=(color)?1:-1, - b=(color)?-1:1; + unsigned long b=(color)?'w':'b', + w=(color)?'b':'w'; char pmask[1][16][16]={{ {w,w,w,w,w,w,o,o,o,o,o,o,o,o,o,o}, {w,b,b,w,w,w,w,o,o,o,o,o,o,o,o,o}, @@ -49,18 +49,26 @@ unsigned char *MakeDummyPointer(DisplaySpecs *specs,int size,int color,int type, {o,o,o,o,o,w,w,b,b,b,w,w,w,o,o,o}, {o,o,o,o,o,o,w,w,w,w,w,w,w,o,o,o}} }; - - unsigned char *ret=malloc(size*sizeof(char[size*4])); - unsigned char wp[4]={255,255,255,255}; - unsigned char bp[4]={0,0,0,0}; + unsigned char wp[4]={ + ((specs->wpixel^0xff000000)>>24), + ((specs->wpixel^0x00ff0000)>>16), + ((specs->wpixel^0x0000ff00)>>8), + ((specs->wpixel^0x000000ff)) + }; + unsigned char bp[4]={ + ((specs->bpixel^0xff000000)>>24), + ((specs->bpixel^0x00ff0000)>>16), + ((specs->bpixel^0x0000ff00)>>8), + ((specs->bpixel^0x000000ff)) + }; *npxl=((wp[0]-1)!=bp[0])?wp[0]-100:wp[0]-102; for(i=0;i<size;i++){ for(k=0;k<size;k++){ - ret[(i*size+k)*4]=(pmask[type][i][k]==1)?wp[0]:(pmask[type][i][k]==-1)?bp[0]:*npxl; - ret[(i*size+k)*4+1]=(pmask[type][i][k]==1)?wp[1]:(pmask[type][i][k]==-1)?bp[1]:*npxl; - ret[(i*size+k)*4+2]=(pmask[type][i][k]==1)?wp[2]:(pmask[type][i][k]==-1)?bp[2]:*npxl; - ret[(i*size+k)*4+3]=(pmask[type][i][k]==1)?wp[3]:(pmask[type][i][k]==-1)?bp[3]:*npxl; + ret[(i*size+k)*4+__ABYTE]=(pmask[type][i][k]=='w')?wp[0]:(pmask[type][i][k]=='b')?bp[0]:*npxl; + ret[(i*size+k)*4+__RBYTE]=(pmask[type][i][k]=='w')?wp[1]:(pmask[type][i][k]=='b')?bp[1]:*npxl; + ret[(i*size+k)*4+__GBYTE]=(pmask[type][i][k]=='w')?wp[2]:(pmask[type][i][k]=='b')?bp[2]:*npxl; + ret[(i*size+k)*4+__BBYTE]=(pmask[type][i][k]=='w')?wp[3]:(pmask[type][i][k]=='b')?bp[3]:*npxl; } } |