mesa: compute row stride outside of loop and fix MSVC compilation error
authorBrian Paul <brianp@vmware.com>
Thu, 8 Jan 2015 21:10:12 +0000 (14:10 -0700)
committerBrian Paul <brianp@vmware.com>
Thu, 8 Jan 2015 21:35:16 +0000 (14:35 -0700)
Can't do void pointer arithmetic with MSVC.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
src/mesa/main/teximage.c

index e41ce32806aa49616f986b7aefae29d5b6bb2266..b3c668f9e54102c6e048e3983b59ebb9fabb3952 100644 (file)
@@ -3543,6 +3543,7 @@ texturesubimage(struct gl_context *ctx, GLuint dims,
 
    /* Must handle special case GL_TEXTURE_CUBE_MAP. */
    if (texObj->Target == GL_TEXTURE_CUBE_MAP) {
+      GLint rowStride;
 
       /* Error checking */
       if (texObj->NumLayers < 6) {
@@ -3594,6 +3595,8 @@ texturesubimage(struct gl_context *ctx, GLuint dims,
          return;
       }
 
+      rowStride = _mesa_image_image_stride(&ctx->Unpack, width, height,
+                                           format, type);
       /* Copy in each face. */
       for (i = 0; i < 6; ++i) {
          texImage = texObj->Image[i][level];
@@ -3601,8 +3604,7 @@ texturesubimage(struct gl_context *ctx, GLuint dims,
                                  level, xoffset, yoffset, zoffset,
                                  width, height, 1, format,
                                  type, pixels, true);
-         pixels += _mesa_image_image_stride(&ctx->Unpack, width, height,
-                                            format, type);
+         pixels = (GLubyte *) pixels + rowStride;
       }
    }
    else {