swrast: add casts for ImageSlices pointer arithmetic

MSVC doesn't like pointer arithmetic with void * so use GLubyte *.

Reviewed-by: Jose Fonseca<jfonseca@vmware.com>
This commit is contained in:
Brian Paul
2013-04-30 13:35:23 -06:00
committed by José Fonseca
parent 22c5e048bd
commit 236ea7900f
2 changed files with 4 additions and 4 deletions
+3 -3
View File
@@ -51,8 +51,8 @@
#elif DIM == 2
#define TEXEL_ADDR( type, image, i, j, k, size ) \
((void) (k), \
((type *)((image)->ImageSlices[0] + (image)->RowStride * (j)) + \
((void) (k), \
((type *)((GLubyte *) (image)->ImageSlices[0] + (image)->RowStride * (j)) + \
(i) * (size)))
#define FETCH(x) fetch_texel_2d_##x
@@ -60,7 +60,7 @@
#elif DIM == 3
#define TEXEL_ADDR( type, image, i, j, k, size ) \
((type *)((image)->ImageSlices[k] + \
((type *)((GLubyte *) (image)->ImageSlices[k] + \
(image)->RowStride * (j)) + (i) * (size))
#define FETCH(x) fetch_texel_3d_##x
+1 -1
View File
@@ -1436,7 +1436,7 @@ opt_sample_rgb_2d(struct gl_context *ctx,
GLint i = IFLOOR(texcoords[k][0] * width) & colMask;
GLint j = IFLOOR(texcoords[k][1] * height) & rowMask;
GLint pos = (j << shift) | i;
GLubyte *texel = swImg->ImageSlices[0] + 3 * pos;
GLubyte *texel = (GLubyte *) swImg->ImageSlices[0] + 3 * pos;
rgba[k][RCOMP] = UBYTE_TO_FLOAT(texel[2]);
rgba[k][GCOMP] = UBYTE_TO_FLOAT(texel[1]);
rgba[k][BCOMP] = UBYTE_TO_FLOAT(texel[0]);