From e4c2e9c97b8419ab4464c8fa30e549853095deb9 Mon Sep 17 00:00:00 2001 From: iovar Date: Wed, 17 Jan 2007 16:45:05 +0000 Subject: fix for xfixes cursor in amd64 (and any arch with sizeof(long)!=4). Xfixes.h declares the pixels as a list of unsigned long instead of CARD32 that is used on the serverside , resulting in 4 byte padding on amd64, where sizeof(long)==8.This was breaking the XFIXES_POINTER_TO_YUV macro, but is now corrected. git-svn-id: https://recordmydesktop.svn.sourceforge.net/svnroot/recordmydesktop/trunk@256 f606c939-3180-4ac9-a4b8-4b8779d57d0a --- recordmydesktop/include/rmdmacro.h | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'recordmydesktop/include') diff --git a/recordmydesktop/include/rmdmacro.h b/recordmydesktop/include/rmdmacro.h index b149b11..b8e529a 100644 --- a/recordmydesktop/include/rmdmacro.h +++ b/recordmydesktop/include/rmdmacro.h @@ -55,6 +55,12 @@ #define __GVALUE(tmp_val) (((tmp_val)&0x0000ff00)>>8) #define __BVALUE(tmp_val) (((tmp_val)&0x000000ff)) +//xfixes pointer data are written as unsigned long +//(even though the server returns CARD32) +//so we need to set the step accordingly to +//avoid problems (amd64 has 8byte ulong) +#define RMD_ULONG_SIZE_T (sizeof(unsigned long)) + //500 mb file size #define CACHE_FILE_SIZE_LIMIT (500*1<<20) @@ -172,8 +178,10 @@ } #define AVG_4_PIXELS(data_array,width_img,k_tm,i_tm,offset)\ - ((data_array[(k_tm*width_img+i_tm)*4+offset]+data_array[((k_tm-1)*width_img+i_tm)*4+offset]\ - +data_array[(k_tm*width_img+i_tm-1)*4+offset]+data_array[((k_tm-1)*width_img+i_tm-1)*4+offset])/4) + ((data_array[(k_tm*width_img+i_tm)*RMD_ULONG_SIZE_T+offset]+\ + data_array[((k_tm-1)*width_img+i_tm)*RMD_ULONG_SIZE_T+offset]+\ + data_array[(k_tm*width_img+i_tm-1)*RMD_ULONG_SIZE_T+offset]+\ + data_array[((k_tm-1)*width_img+i_tm-1)*RMD_ULONG_SIZE_T+offset])/4) #define UPDATE_YUV_BUFFER_SH(yuv,data,x_tm,y_tm,width_tm,height_tm){\ int k,i;\ @@ -370,8 +378,9 @@ for(k=0;ky[x_tm+i+(k+y_tm)*yuv->y_width]=\ - (yuv->y[x_tm+i+(k+y_tm)*yuv->y_width]*(UCHAR_MAX-data[(j*4)+__ABYTE])+\ - (Yr[data[(j*4)+__RBYTE]] + Yg[data[(j*4)+__GBYTE]] + Yb[data[(j*4)+__BBYTE]])*data[(j*4)+__ABYTE])/UCHAR_MAX ;\ + (yuv->y[x_tm+i+(k+y_tm)*yuv->y_width]*(UCHAR_MAX-data[(j*RMD_ULONG_SIZE_T)+__ABYTE])+\ + (Yr[data[(j*RMD_ULONG_SIZE_T)+__RBYTE]] + Yg[data[(j*RMD_ULONG_SIZE_T)+__GBYTE]] +\ + Yb[data[(j*RMD_ULONG_SIZE_T)+__BBYTE]])*data[(j*RMD_ULONG_SIZE_T)+__ABYTE])/UCHAR_MAX ;\ if((k%2)&&(i%2)){\ avg3=AVG_4_PIXELS(data,(width_tm+column_discard_stride),k,i,__ABYTE);\ avg2=AVG_4_PIXELS(data,(width_tm+column_discard_stride),k,i,__RBYTE);\ -- cgit v1.2.3