diff options
author | Brian <[email protected]> | 2007-03-12 09:35:44 -0600 |
---|---|---|
committer | Brian <[email protected]> | 2007-03-12 09:50:27 -0600 |
commit | c1a544733749cd388b9f51d087c695b2ce0ec729 (patch) | |
tree | ddd9a07312604157096e04c2a9ba5ec107f98a60 /src/mesa/main/image.c | |
parent | d0a3400f66b8c4ace7ebef6d0a944376d5203756 (diff) |
take GL_UNPACK_ALIGNMENT into account in _mesa_image_row_stride() for GL_BITMAP type (bug 10261)
Diffstat (limited to 'src/mesa/main/image.c')
-rw-r--r-- | src/mesa/main/image.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c index eb91ebb6110..58dd771484c 100644 --- a/src/mesa/main/image.c +++ b/src/mesa/main/image.c @@ -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 { |