cBitsPixel = gajBitsPerFormat[pso->iBitmapFormat];
/* Is a width in bytes given? */
- if (ulWidth)
- {
- /* Align the width (Windows compatibility) */
- ulWidth = ((((ulWidth << 3) / cBitsPixel) * cBitsPixel + 31) & ~31) >> 3;
- }
- else
+ if (!ulWidth)
{
/* Calculate width from the bitmap width in pixels */
- ulWidth = ((pso->sizlBitmap.cx * cBitsPixel + 31) & ~31) >> 3;
+ ulWidth = DIB_GetDIBWidthBytes(psurf->SurfObj.sizlBitmap.cx, cBitsPixel);
}
+ else
+ {
+ /* Align the width (windows compatibility, drivers expect that) */
+ ((((ulWidth << 3) / cBitsPixel) * cBitsPixel + 31) & ~31) >> 3;
+ }
+
/* Calculate the bitmap size in bytes */
pso->cjBits = ulWidth * pso->sizlBitmap.cy;