Browse Source

fixed alignment bug in _mesa_image_row_stride()

tags/mesa_3_3
Brian Paul 26 years ago
parent
commit
fbbac25ad3
1 changed files with 8 additions and 5 deletions
  1. 8
    5
      src/mesa/main/image.c

+ 8
- 5
src/mesa/main/image.c View File

/* $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 * Mesa 3-D graphics library
else { else {
/* Non-BITMAP data */ /* Non-BITMAP data */
const GLint bytesPerPixel = _mesa_bytes_per_pixel(format, type); const GLint bytesPerPixel = _mesa_bytes_per_pixel(format, type);
GLint bytesPerRow, remainder;
if (bytesPerPixel <= 0) if (bytesPerPixel <= 0)
return -1; /* error */ return -1; /* error */
if (packing->RowLength == 0) { if (packing->RowLength == 0) {
GLint bytes = bytesPerPixel * width;
return bytes;
bytesPerRow = bytesPerPixel * width;
} }
else { 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;
} }
} }



Loading…
Cancel
Save