mesa: replace gl_texture_format with gl_format
[mesa.git] / src / mesa / drivers / dri / r128 / r128_texmem.c
index 111fe1fd7424a8746d45f2668e2ea238c297bbdd..84f8563b89d08e3f280e694c90e36618f3aeeb90 100644 (file)
@@ -95,7 +95,7 @@ static void uploadSubImage( r128ContextPtr rmesa, r128TexObjPtr t,
    if ( !image )
       return;
 
-   switch ( image->TexFormat->TexelBytes ) {
+   switch ( _mesa_get_format_bytes(image->TexFormat) ) {
    case 1: texelsPerDword = 4; break;
    case 2: texelsPerDword = 2; break;
    case 4: texelsPerDword = 1; break;
@@ -215,9 +215,11 @@ static void uploadSubImage( r128ContextPtr rmesa, r128TexObjPtr t,
 
       /* Copy the next chunck of the texture image into the blit buffer */
       {
+         const GLuint texelBytes =
+            _mesa_get_format_bytes(image->TexFormat);
          const GLubyte *src = (const GLubyte *) image->Data +
-            (y * image->Width + x) * image->TexFormat->TexelBytes;
-         const GLuint bytes = width * height * image->TexFormat->TexelBytes;
+            (y * image->Width + x) * texelBytes;            
+         const GLuint bytes = width * height * texelBytes;
          memcpy(dst, src, bytes);
       }