Mesa (master): Use row stride instead of width when getting colour index texels.

Michel Dänzer daenzer at kemper.freedesktop.org
Wed Mar 30 08:52:31 UTC 2011


Module: Mesa
Branch: master
Commit: 72e82418ef035dd4fb502e7f0a7e2e869ce8a444
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=72e82418ef035dd4fb502e7f0a7e2e869ce8a444

Author: Michel Dänzer <daenzer at vmware.com>
Date:   Wed Mar 30 10:48:37 2011 +0200

Use row stride instead of width when getting colour index texels.

Untested, noticed while working on the depth/stencil fix.

---

 src/mesa/main/texgetimage.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c
index db2cc84..7070a29 100644
--- a/src/mesa/main/texgetimage.c
+++ b/src/mesa/main/texgetimage.c
@@ -74,6 +74,7 @@ get_tex_color_index(struct gl_context *ctx, GLuint dimensions,
    const GLint width = texImage->Width;
    const GLint height = texImage->Height;
    const GLint depth = texImage->Depth;
+   const GLint rowstride = texImage->RowStride;
    const GLuint indexBits =
       _mesa_get_format_bits(texImage->TexFormat, GL_TEXTURE_INDEX_SIZE_EXT);
    const GLbitfield transferOps = 0x0;
@@ -89,14 +90,14 @@ get_tex_color_index(struct gl_context *ctx, GLuint dimensions,
 
          if (indexBits == 8) {
             const GLubyte *src = (const GLubyte *) texImage->Data;
-            src += width * (img * texImage->Height + row);
+            src += rowstride * (img * height + row);
             for (col = 0; col < width; col++) {
                indexRow[col] = src[col];
             }
          }
          else if (indexBits == 16) {
             const GLushort *src = (const GLushort *) texImage->Data;
-            src += width * (img * texImage->Height + row);
+            src += rowstride * (img * height + row);
             for (col = 0; col < width; col++) {
                indexRow[col] = src[col];
             }




More information about the mesa-commit mailing list