-/* $Id: texutil.c,v 1.19 2001/03/27 19:18:02 gareth Exp $ */
+/* $Id: texutil.c,v 1.20 2001/03/27 20:32:24 brianp Exp $ */
/*
* Mesa 3-D graphics library
#define DST_TYPE GLuint
#define DST_TEXELS_PER_DWORD 1
-#define CONVERT_TEXEL( src ) \
- PACK_COLOR_8888( src[3], src[2], src[1], src[0] )
+#define CONVERT_TEXEL( dst, src ) \
+ dst = PACK_COLOR_8888( src[3], src[2], src[1], src[0] )
#define CONVERT_DIRECT
#include "texutil_tmp.h"
-#define CONVERT_TEXEL( src ) \
- PACK_COLOR_8888( src[0], src[1], src[2], src[3] )
+#define CONVERT_TEXEL( dst, src ) \
+ dst = PACK_COLOR_8888( src[0], src[1], src[2], src[3] )
-#define CONVERT_TEXEL_DWORD( src ) CONVERT_TEXEL( src )
+#define CONVERT_TEXEL_DWORD( dst, src ) CONVERT_TEXEL( dst, src )
#define SRC_TEXEL_BYTES 4
#include "texutil_tmp.h"
-#define CONVERT_TEXEL( src ) \
- PACK_COLOR_8888( src[0], src[1], src[2], 0xff )
+#define CONVERT_TEXEL( dst, src ) \
+ dst = PACK_COLOR_8888( src[0], src[1], src[2], 0xff )
-#define CONVERT_TEXEL_DWORD( src ) CONVERT_TEXEL( src )
+#define CONVERT_TEXEL_DWORD( dst, src ) CONVERT_TEXEL( dst, src )
#define SRC_TEXEL_BYTES 3
#define DST_TYPE GLuint
#define DST_TEXELS_PER_DWORD 1
-#define CONVERT_TEXEL( src ) \
- PACK_COLOR_8888( src[3], src[2], src[1], src[0] )
+#define CONVERT_TEXEL( dst, src ) \
+ dst = PACK_COLOR_8888( src[3], src[2], src[1], src[0] )
#define CONVERT_DIRECT
#include "texutil_tmp.h"
-#define CONVERT_TEXEL( src ) \
- PACK_COLOR_8888( src[3], src[0], src[1], src[2] )
+#define CONVERT_TEXEL( dst, src ) \
+ dst = PACK_COLOR_8888( src[3], src[0], src[1], src[2] )
-#define CONVERT_TEXEL_DWORD( src ) CONVERT_TEXEL( src )
+#define CONVERT_TEXEL_DWORD( dst, src ) CONVERT_TEXEL( dst, src )
#define SRC_TEXEL_BYTES 4
#include "texutil_tmp.h"
-#define CONVERT_TEXEL( src ) \
- PACK_COLOR_8888( 0xff, src[0], src[1], src[2] )
+#define CONVERT_TEXEL( dst, src ) \
+ dst = PACK_COLOR_8888( 0xff, src[0], src[1], src[2] )
-#define CONVERT_TEXEL_DWORD( src ) CONVERT_TEXEL( src )
+#define CONVERT_TEXEL_DWORD( dst, src ) CONVERT_TEXEL( dst, src )
#define SRC_TEXEL_BYTES 3
#define DST_TYPE GLushort
#define DST_TEXELS_PER_DWORD 2
-#define CONVERT_TEXEL( src ) \
- PACK_COLOR_565( src[0], src[1], src[2] )
+#define CONVERT_TEXEL( dst, src ) \
+ dst = PACK_COLOR_565( src[0], src[1], src[2] )
#define CONVERT_DIRECT
#include "texutil_tmp.h"
-#define CONVERT_TEXEL( src ) \
- PACK_COLOR_565( src[0], src[1], src[2] )
+#define CONVERT_TEXEL( dst, src ) \
+ dst = PACK_COLOR_565( src[0], src[1], src[2] )
-#define CONVERT_TEXEL_DWORD( src ) \
- ((PACK_COLOR_565( src[0], src[1], src[2] )) | \
+#define CONVERT_TEXEL_DWORD( dst, src ) \
+ dst = ((PACK_COLOR_565( src[0], src[1], src[2] )) | \
(PACK_COLOR_565( src[3], src[4], src[5] ) << 16))
#define SRC_TEXEL_BYTES 3
#include "texutil_tmp.h"
-#define CONVERT_TEXEL( src ) \
- PACK_COLOR_565( src[0], src[1], src[2] )
+#define CONVERT_TEXEL( dst, src ) \
+ dst = PACK_COLOR_565( src[0], src[1], src[2] )
-#define CONVERT_TEXEL_DWORD( src ) \
- ((PACK_COLOR_565( src[0], src[1], src[2] )) | \
- (PACK_COLOR_565( src[4], src[5], src[6] ) << 16))
+#define CONVERT_TEXEL_DWORD( dst, src ) \
+ dst = ((PACK_COLOR_565( src[0], src[1], src[2] )) | \
+ (PACK_COLOR_565( src[4], src[5], src[6] ) << 16))
#define SRC_TEXEL_BYTES 4
#define DST_TYPE GLushort
#define DST_TEXELS_PER_DWORD 2
-#define CONVERT_TEXEL( src ) \
- PACK_COLOR_4444( src[3], src[0], src[1], src[2] )
+#define CONVERT_TEXEL( dst, src ) \
+ dst = PACK_COLOR_4444( src[3], src[0], src[1], src[2] )
#define CONVERT_DIRECT
#include "texutil_tmp.h"
-#define CONVERT_TEXEL( src ) \
- PACK_COLOR_4444( src[3], src[0], src[1], src[2] )
+#define CONVERT_TEXEL( dst, src ) \
+ dst = PACK_COLOR_4444( src[3], src[0], src[1], src[2] )
-#define CONVERT_TEXEL_DWORD( src ) \
- ((PACK_COLOR_4444( src[3], src[0], src[1], src[2] )) | \
- (PACK_COLOR_4444( src[7], src[4], src[5], src[6] ) << 16))
+#define CONVERT_TEXEL_DWORD( dst, src ) \
+ dst = ((PACK_COLOR_4444( src[3], src[0], src[1], src[2] )) |\
+ (PACK_COLOR_4444( src[7], src[4], src[5], src[6] ) << 16))
#define SRC_TEXEL_BYTES 4
#define DST_TYPE GLushort
#define DST_TEXELS_PER_DWORD 2
-#define CONVERT_TEXEL( src ) \
- PACK_COLOR_1555( src[3], src[0], src[1], src[2] )
+#define CONVERT_TEXEL( dst, src ) \
+ dst = PACK_COLOR_1555( src[3], src[0], src[1], src[2] )
#define CONVERT_DIRECT
#include "texutil_tmp.h"
-#define CONVERT_TEXEL( src ) \
- ({ GLushort s = *(GLushort *)src; \
- s = (s >> 1) | ((s & 1) << 15); s; })
+#define CONVERT_TEXEL( dst, src ) \
+ { const GLushort s = *(GLushort *)src; \
+ dst = (s >> 1) | ((s & 1) << 15); }
-#define CONVERT_TEXEL_DWORD( src ) \
- ({ GLuint s = *(GLuint *)src; \
- s = (((s & 0xfffefffe) >> 1) | \
- ((s & 0x00010001) << 15)); s; })
+#define CONVERT_TEXEL_DWORD( dst, src ) \
+ { const GLuint s = *(GLuint *)src; \
+ dst = (((s & 0xfffefffe) >> 1) | \
+ ((s & 0x00010001) << 15)); }
#define SRC_TEXEL_BYTES 2
#include "texutil_tmp.h"
-#define CONVERT_TEXEL( src ) \
- PACK_COLOR_1555( src[3], src[0], src[1], src[2] )
+#define CONVERT_TEXEL( dst, src ) \
+ dst = PACK_COLOR_1555( src[3], src[0], src[1], src[2] )
-#define CONVERT_TEXEL_DWORD( src ) \
- ((PACK_COLOR_1555( src[3], src[0], src[1], src[2] )) | \
- (PACK_COLOR_1555( src[7], src[4], src[5], src[6] ) << 16))
+#define CONVERT_TEXEL_DWORD( dst, src ) \
+ dst = ((PACK_COLOR_1555( src[3], src[0], src[1], src[2] )) |\
+ (PACK_COLOR_1555( src[7], src[4], src[5], src[6] ) << 16))
#define SRC_TEXEL_BYTES 4
#define DST_TYPE GLushort
#define DST_TEXELS_PER_DWORD 2
-#define CONVERT_TEXEL( src ) \
- PACK_COLOR_88( src[0], src[1] )
+#define CONVERT_TEXEL( dst, src ) \
+ dst = PACK_COLOR_88( src[0], src[1] )
#define CONVERT_DIRECT
#include "texutil_tmp.h"
-#define CONVERT_TEXEL( src ) \
- PACK_COLOR_88( src[0], 0x00 )
+#define CONVERT_TEXEL( dst, src ) \
+ dst = PACK_COLOR_88( src[0], 0x00 )
-#define CONVERT_TEXEL_DWORD( src ) \
- ((PACK_COLOR_88( src[0], 0x00 )) | \
- (PACK_COLOR_88( src[1], 0x00 ) << 16))
+#define CONVERT_TEXEL_DWORD( dst, src ) \
+ dst = ((PACK_COLOR_88( src[0], 0x00 )) | \
+ (PACK_COLOR_88( src[1], 0x00 ) << 16))
#define SRC_TEXEL_BYTES 1
#include "texutil_tmp.h"
-#define CONVERT_TEXEL( src ) \
- PACK_COLOR_88( 0xff, src[0] )
+#define CONVERT_TEXEL( dst, src ) \
+ dst = PACK_COLOR_88( 0xff, src[0] )
-#define CONVERT_TEXEL_DWORD( src ) \
- ((PACK_COLOR_88( 0xff, src[0] )) | \
- (PACK_COLOR_88( 0xff, src[1] ) << 16))
+#define CONVERT_TEXEL_DWORD( dst, src ) \
+ dst = ((PACK_COLOR_88( 0xff, src[0] )) | \
+ (PACK_COLOR_88( 0xff, src[1] ) << 16))
#define SRC_TEXEL_BYTES 1
#include "texutil_tmp.h"
-#define CONVERT_TEXEL( src ) \
- PACK_COLOR_88( src[3], src[0] )
+#define CONVERT_TEXEL( dst, src ) \
+ dst = PACK_COLOR_88( src[3], src[0] )
-#define CONVERT_TEXEL_DWORD( src ) \
- ((PACK_COLOR_88( src[3], src[0] )) | \
- (PACK_COLOR_88( src[7], src[1] ) << 16))
+#define CONVERT_TEXEL_DWORD( dst, src ) \
+ dst = ((PACK_COLOR_88( src[3], src[0] )) | \
+ (PACK_COLOR_88( src[7], src[1] ) << 16))
#define SRC_TEXEL_BYTES 4
#define DST_TYPE GLubyte
#define DST_TEXELS_PER_DWORD 4
-#define CONVERT_TEXEL( src ) src[0]
+#define CONVERT_TEXEL( dst, src ) dst = src[0]
#define CONVERT_DIRECT
-/* $Id: texutil_tmp.h,v 1.5 2001/03/21 16:44:08 brianp Exp $ */
+/* $Id: texutil_tmp.h,v 1.6 2001/03/27 20:32:24 brianp Exp $ */
/*
* Mesa 3-D graphics library
DST_TEXELS_PER_DWORD - 1) / DST_TEXELS_PER_DWORD;
for ( i = 0 ; i < dwords ; i++ ) {
- *dst++ = CONVERT_TEXEL_DWORD( src );
+ CONVERT_TEXEL_DWORD( *dst++, src );
src += SRC_TEXEL_BYTES * DST_TEXELS_PER_DWORD;
}
#endif
DST_TEXELS_PER_DWORD - 1) / DST_TEXELS_PER_DWORD;
for ( i = 0 ; i < dwords ; i++ ) {
- *dst++ = CONVERT_TEXEL_DWORD( src );
+ CONVERT_TEXEL_DWORD( *dst++, src );
src += SRC_TEXEL_BYTES * DST_TEXELS_PER_DWORD;
}
#endif
for ( row = 0 ; row < convert->height ; row++ ) {
for ( col = 0 ; col < convert->width ; col++ ) {
- *dst++ = CONVERT_TEXEL( src );
+ CONVERT_TEXEL( *dst++, src );
src += SRC_TEXEL_BYTES;
}
dst += adjust;
for ( img = 0 ; img < convert->depth ; img++ ) {
for ( row = 0 ; row < convert->height ; row++ ) {
for ( col = 0 ; col < convert->width ; col++ ) {
- *dst++ = CONVERT_TEXEL( src );
+ CONVERT_TEXEL( *dst++, src );
src += SRC_TEXEL_BYTES;
}
dst += adjust;
#else
const GLubyte *srcRow = src;
for ( col = width / DST_TEXELS_PER_DWORD ; col ; col-- ) {
- *dst++ = CONVERT_TEXEL_DWORD( src );
+ CONVERT_TEXEL_DWORD( *dst++, src );
src += SRC_TEXEL_BYTES * DST_TEXELS_PER_DWORD;
}
src = srcRow + srcRowStride;
#else
const GLubyte *srcRow = src;
for ( col = width / DST_TEXELS_PER_DWORD ; col ; col-- ) {
- *dst++ = CONVERT_TEXEL_DWORD( src );
+ CONVERT_TEXEL_DWORD( *dst++, src );
src += SRC_TEXEL_BYTES * DST_TEXELS_PER_DWORD;
}
src = srcRow + srcRowStride;
#else
const GLubyte *srcRow = src;
for ( col = 0 ; col < convert->width ; col++ ) {
- *dst++ = CONVERT_TEXEL( src );
+ CONVERT_TEXEL( *dst++, src );
src += SRC_TEXEL_BYTES;
}
src = srcRow + srcRowStride;
#else
const GLubyte *srcRow = src;
for ( col = 0 ; col < convert->width ; col++ ) {
- *dst++ = CONVERT_TEXEL( src );
+ CONVERT_TEXEL( *dst++, src );
src += SRC_TEXEL_BYTES;
}
src = srcRow + srcRowStride;