swrast: add casts for ImageSlices pointer arithmetic
authorBrian Paul <brianp@vmware.com>
Tue, 30 Apr 2013 19:35:23 +0000 (13:35 -0600)
committerJosé Fonseca <jfonseca@vmware.com>
Wed, 1 May 2013 10:53:02 +0000 (11:53 +0100)
MSVC doesn't like pointer arithmetic with void * so use GLubyte *.

Reviewed-by: Jose Fonseca<jfonseca@vmware.com>
src/mesa/swrast/s_texfetch_tmp.h
src/mesa/swrast/s_texfilter.c

index c9991cd84d9cb089467dc13a31d115c6a5a72658..44fa8170b2ca56ba4b2822809ff2aba7f61f922d 100644 (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
index c8ea26adae8e2d48a0e8f9a7476574b570af3a6f..fba8e6cba8084d037de6d09c5c776818ab4a981e 100644 (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]);