mirror of
https://github.com/reactos/reactos.git
synced 2025-05-14 23:03:53 +00:00
Add macros WIDTH_BYTES_ALIGN16/32
svn path=/branches/reactos-yarotows/; revision=48675
This commit is contained in:
parent
ce75f117fd
commit
61c05f8d3d
2 changed files with 9 additions and 6 deletions
|
@ -200,18 +200,17 @@ SURFACE_bSetBitmapBits(
|
||||||
cBitsPixel = gajBitsPerFormat[pso->iBitmapFormat];
|
cBitsPixel = gajBitsPerFormat[pso->iBitmapFormat];
|
||||||
|
|
||||||
/* Is a width in bytes given? */
|
/* Is a width in bytes given? */
|
||||||
if (!ulWidth)
|
if (ulWidth)
|
||||||
{
|
{
|
||||||
/* Calculate width from the bitmap width in pixels */
|
/* Align the width (Windows compatibility, drivers expect that) */
|
||||||
ulWidth = DIB_GetDIBWidthBytes(psurf->SurfObj.sizlBitmap.cx, cBitsPixel);
|
ulWidth = WIDTH_BYTES_ALIGN32((ulWidth << 3) / cBitsPixel, cBitsPixel);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Align the width (windows compatibility, drivers expect that) */
|
/* Calculate width from the bitmap width in pixels */
|
||||||
ulWidth = ((((ulWidth << 3) / cBitsPixel) * cBitsPixel + 31) & ~31) >> 3;
|
ulWidth = WIDTH_BYTES_ALIGN32(pso->sizlBitmap.cx, cBitsPixel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Calculate the bitmap size in bytes */
|
/* Calculate the bitmap size in bytes */
|
||||||
pso->cjBits = ulWidth * pso->sizlBitmap.cy;
|
pso->cjBits = ulWidth * pso->sizlBitmap.cy;
|
||||||
|
|
||||||
|
|
|
@ -128,3 +128,7 @@ SURFACE_bSetBitmapBits(
|
||||||
ULONG FASTCALL BitmapFormat (WORD Bits, DWORD Compression);
|
ULONG FASTCALL BitmapFormat (WORD Bits, DWORD Compression);
|
||||||
extern UCHAR gajBitsPerFormat[];
|
extern UCHAR gajBitsPerFormat[];
|
||||||
#define BitsPerFormat(Format) gajBitsPerFormat[Format]
|
#define BitsPerFormat(Format) gajBitsPerFormat[Format]
|
||||||
|
|
||||||
|
#define WIDTH_BYTES_ALIGN32(cx, bpp) ((((cx) * (bpp) + 31) & ~31) >> 3)
|
||||||
|
#define WIDTH_BYTES_ALIGN16(cx, bpp) ((((cx) * (bpp) + 15) & ~15) >> 3)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue