take GL_UNPACK_ALIGNMENT into account in _mesa_image_row_stride() for GL_BITMAP type...
authorBrian <brian@yutani.localnet.net>
Mon, 12 Mar 2007 15:35:44 +0000 (09:35 -0600)
committerBrian <brian@yutani.localnet.net>
Mon, 12 Mar 2007 15:50:27 +0000 (09:50 -0600)
src/mesa/main/image.c

index eb91ebb61106d3d6749da7ab7ab3338c99f52ea2..58dd771484c51270bf30140b5d07fc0f96a108ef 100644 (file)
@@ -667,7 +667,7 @@ _mesa_image_row_stride( const struct gl_pixelstore_attrib *packing,
    ASSERT(packing);
    if (type == GL_BITMAP) {
       /* BITMAP data */
-      GLint bytes;
+      GLint bytes, remainder;
       if (packing->RowLength == 0) {
          bytes = (width + 7) / 8;
       }
@@ -678,6 +678,11 @@ _mesa_image_row_stride( const struct gl_pixelstore_attrib *packing,
          /* negate the bytes per row (negative row stride) */
          bytes = -bytes;
       }
+
+      remainder = bytes % packing->Alignment;
+      if (remainder > 0)
+         bytes += (packing->Alignment - remainder);
+
       return bytes;
    }
    else {