summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2000-05-19 22:35:44 +0000
committerBrian Paul <[email protected]>2000-05-19 22:35:44 +0000
commitfbbac25ad304e09a4cde52bd09b4940ac4785623 (patch)
treec68a417809f1ba9bcbfc14c8371b2b0e0def0fc9 /src/mesa/main
parentcc2b08ddf0c6f522172f972526ce34f74a242141 (diff)
fixed alignment bug in _mesa_image_row_stride()
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/image.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c
index dc6abb39d7d..627ab1510e7 100644
--- a/src/mesa/main/image.c
+++ b/src/mesa/main/image.c
@@ -1,4 +1,4 @@
-/* $Id: image.c,v 1.31 2000/05/10 14:39:53 brianp Exp $ */
+/* $Id: image.c,v 1.32 2000/05/19 22:35:44 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -519,16 +519,19 @@ _mesa_image_row_stride( const struct gl_pixelstore_attrib *packing,
else {
/* Non-BITMAP data */
const GLint bytesPerPixel = _mesa_bytes_per_pixel(format, type);
+ GLint bytesPerRow, remainder;
if (bytesPerPixel <= 0)
return -1; /* error */
if (packing->RowLength == 0) {
- GLint bytes = bytesPerPixel * width;
- return bytes;
+ bytesPerRow = bytesPerPixel * width;
}
else {
- GLint bytes = bytesPerPixel * packing->RowLength;
- return bytes;
+ bytesPerRow = bytesPerPixel * packing->RowLength;
}
+ remainder = bytesPerRow % packing->Alignment;
+ if (remainder > 0)
+ bytesPerRow += (packing->Alignment - remainder);
+ return bytesPerRow;
}
}