mirror of
https://github.com/reactos/reactos.git
synced 2025-03-30 17:10:22 +00:00
[WIN32K]
- Use newly introduced macros and get rid of related functions - Ignore alpha channels of solid brush color svn path=/branches/reactos-yarotows/; revision=48680
This commit is contained in:
parent
61c05f8d3d
commit
b0fe5ee433
8 changed files with 13 additions and 62 deletions
|
@ -158,7 +158,7 @@ BltPatCopy(SURFOBJ* Dest,
|
|||
// These functions are assigned if we're working with a DIB
|
||||
// The assigned functions depend on the bitsPerPixel of the DIB
|
||||
|
||||
DibFunctionsForBitmapFormat[Dest->iBitmapFormat].DIB_ColorFill(Dest, DestRect, pbo ? pbo->iSolidColor : 0);
|
||||
DibFunctionsForBitmapFormat[Dest->iBitmapFormat].DIB_ColorFill(Dest, DestRect, pbo ? (pbo->iSolidColor &0x00ffffff): 0);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -144,7 +144,7 @@ EngRealizeBrush(
|
|||
ULONG lWidth;
|
||||
|
||||
/* Calculate width in bytes of the realized brush */
|
||||
lWidth = DIB_GetDIBWidthBytes(psoPattern->sizlBitmap.cx,
|
||||
lWidth = WIDTH_BYTES_ALIGN32(psoPattern->sizlBitmap.cx,
|
||||
BitsPerFormat(psoDst->iBitmapFormat));
|
||||
|
||||
/* Allocate a bitmap */
|
||||
|
|
|
@ -64,7 +64,7 @@ IntEngEnter(PINTENG_ENTER_LEAVE EnterLeave,
|
|||
/* Allocate a temporary bitmap */
|
||||
BitmapSize.cx = DestRect->right - DestRect->left;
|
||||
BitmapSize.cy = DestRect->bottom - DestRect->top;
|
||||
Width = DIB_GetDIBWidthBytes(BitmapSize.cx, BitsPerFormat(psoDest->iBitmapFormat));
|
||||
Width = WIDTH_BYTES_ALIGN32(BitmapSize.cx, BitsPerFormat(psoDest->iBitmapFormat));
|
||||
EnterLeave->OutputBitmap = EngCreateBitmap(BitmapSize, Width,
|
||||
psoDest->iBitmapFormat,
|
||||
BMF_TOPDOWN | BMF_NOZEROINIT, NULL);
|
||||
|
|
|
@ -334,7 +334,7 @@ EngSetPointerShape(
|
|||
rectl.bottom = sizel.cy;
|
||||
|
||||
/* Calculate lDelta for our surfaces. */
|
||||
lDelta = DIB_GetDIBWidthBytes(sizel.cx,
|
||||
lDelta = WIDTH_BYTES_ALIGN32(sizel.cx,
|
||||
BitsPerFormat(pso->iBitmapFormat));
|
||||
|
||||
/* Create a bitmap for saving the pixels under the cursor. */
|
||||
|
|
|
@ -12,7 +12,6 @@ INT APIENTRY BITMAP_GetObject(SURFACE * bmp, INT count, LPVOID buffer);
|
|||
HBITMAP FASTCALL IntCreateBitmap(IN SIZEL Size, IN LONG Width, IN ULONG Format, IN ULONG Flags, IN PVOID Bits);
|
||||
HBITMAP FASTCALL BITMAP_CopyBitmap (HBITMAP hBitmap);
|
||||
UINT FASTCALL BITMAP_GetRealBitsPixel(UINT nBitsPixel);
|
||||
INT FASTCALL BITMAP_GetWidthBytes (INT bmWidth, INT bpp);
|
||||
|
||||
HBITMAP
|
||||
APIENTRY
|
||||
|
|
|
@ -11,8 +11,6 @@ DIB_GetBitmapInfo( const BITMAPINFOHEADER *header, LONG *width,
|
|||
LONG *height, WORD *planes, WORD *bpp, DWORD *compr, DWORD *size );
|
||||
INT APIENTRY
|
||||
DIB_GetDIBImageBytes (INT width, INT height, INT depth);
|
||||
INT FASTCALL
|
||||
DIB_GetDIBWidthBytes (INT width, INT depth);
|
||||
HPALETTE FASTCALL
|
||||
DIB_MapPaletteColors(PPALETTE ppal, CONST BITMAPINFO* lpbmi);
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ UnsafeSetBitmapBits(
|
|||
pjDst = psurf->SurfObj.pvScan0;
|
||||
pjSrc = pvBits;
|
||||
lDeltaDst = psurf->SurfObj.lDelta;
|
||||
lDeltaSrc = BITMAP_GetWidthBytes(nWidth, cBitsPixel);
|
||||
lDeltaSrc = WIDTH_BYTES_ALIGN16(nWidth, cBitsPixel);
|
||||
|
||||
while (nHeight--)
|
||||
{
|
||||
|
@ -186,7 +186,7 @@ NtGdiCreateBitmap(
|
|||
}
|
||||
|
||||
/* Make sure that cjBits will not overflow */
|
||||
cjWidthBytes = BITMAP_GetWidthBytes(nWidth, cBitsPixel);
|
||||
cjWidthBytes = WIDTH_BYTES_ALIGN16(nWidth, cBitsPixel);
|
||||
if ((ULONGLONG)cjWidthBytes * nHeight >= 0x100000000ULL)
|
||||
{
|
||||
DPRINT1("Width = %d, Height = %d BitsPixel = %d\n",
|
||||
|
@ -581,7 +581,7 @@ UnsafeGetBitmapBits(
|
|||
pjSrc = psurf->SurfObj.pvScan0;
|
||||
pjDst = pvBits;
|
||||
lDeltaSrc = psurf->SurfObj.lDelta;
|
||||
lDeltaDst = BITMAP_GetWidthBytes(nWidth, cBitsPixel);
|
||||
lDeltaDst = WIDTH_BYTES_ALIGN16(nWidth, cBitsPixel);
|
||||
|
||||
while (nHeight--)
|
||||
{
|
||||
|
@ -613,7 +613,7 @@ NtGdiGetBitmapBits(
|
|||
return 0;
|
||||
}
|
||||
|
||||
bmSize = BITMAP_GetWidthBytes(psurf->SurfObj.sizlBitmap.cx,
|
||||
bmSize = WIDTH_BYTES_ALIGN16(psurf->SurfObj.sizlBitmap.cx,
|
||||
BitsPerFormat(psurf->SurfObj.iBitmapFormat)) *
|
||||
abs(psurf->SurfObj.sizlBitmap.cy);
|
||||
|
||||
|
@ -858,40 +858,6 @@ BITMAP_GetRealBitsPixel(UINT nBitsPixel)
|
|||
return 0;
|
||||
}
|
||||
|
||||
INT FASTCALL
|
||||
BITMAP_GetWidthBytes(INT bmWidth, INT bpp)
|
||||
{
|
||||
#if 0
|
||||
switch (bpp)
|
||||
{
|
||||
case 1:
|
||||
return 2 * ((bmWidth+15) >> 4);
|
||||
|
||||
case 24:
|
||||
bmWidth *= 3; /* fall through */
|
||||
case 8:
|
||||
return bmWidth + (bmWidth & 1);
|
||||
|
||||
case 32:
|
||||
return bmWidth * 4;
|
||||
|
||||
case 16:
|
||||
case 15:
|
||||
return bmWidth * 2;
|
||||
|
||||
case 4:
|
||||
return 2 * ((bmWidth+3) >> 2);
|
||||
|
||||
default:
|
||||
DPRINT ("stub");
|
||||
}
|
||||
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
return ((bmWidth * bpp + 15) & ~15) >> 3;
|
||||
}
|
||||
|
||||
HBITMAP FASTCALL
|
||||
BITMAP_CopyBitmap(HBITMAP hBitmap)
|
||||
{
|
||||
|
@ -963,7 +929,7 @@ BITMAP_GetObject(SURFACE *psurf, INT Count, LPVOID buffer)
|
|||
pBitmap->bmHeight = psurf->SurfObj.sizlBitmap.cy;
|
||||
pBitmap->bmPlanes = 1;
|
||||
pBitmap->bmBitsPixel = BitsPerFormat(psurf->SurfObj.iBitmapFormat);
|
||||
pBitmap->bmWidthBytes = BITMAP_GetWidthBytes(pBitmap->bmWidth, pBitmap->bmBitsPixel);
|
||||
pBitmap->bmWidthBytes = WIDTH_BYTES_ALIGN16(pBitmap->bmWidth, pBitmap->bmBitsPixel);
|
||||
|
||||
/* Check for DIB section */
|
||||
if (psurf->hSecure)
|
||||
|
@ -971,7 +937,7 @@ BITMAP_GetObject(SURFACE *psurf, INT Count, LPVOID buffer)
|
|||
/* Set bmBits in this case */
|
||||
pBitmap->bmBits = psurf->SurfObj.pvBits;
|
||||
/* DIBs data are 32 bits aligned */
|
||||
pBitmap->bmWidthBytes = DIB_GetDIBWidthBytes(pBitmap->bmWidth, pBitmap->bmBitsPixel);
|
||||
pBitmap->bmWidthBytes = WIDTH_BYTES_ALIGN32(pBitmap->bmWidth, pBitmap->bmBitsPixel);
|
||||
|
||||
if (Count >= sizeof(DIBSECTION))
|
||||
{
|
||||
|
|
|
@ -480,7 +480,7 @@ NtGdiSetDIBitsToDeviceInternal(
|
|||
SourceSize.cx = bmi->bmiHeader.biWidth;
|
||||
SourceSize.cy = ScanLines;
|
||||
|
||||
DIBWidth = DIB_GetDIBWidthBytes(SourceSize.cx, bmi->bmiHeader.biBitCount);
|
||||
DIBWidth = WIDTH_BYTES_ALIGN32(SourceSize.cx, bmi->bmiHeader.biBitCount);
|
||||
|
||||
hSourceBitmap = EngCreateBitmap(SourceSize,
|
||||
DIBWidth,
|
||||
|
@ -1390,7 +1390,7 @@ DIB_CreateDIBSection(
|
|||
bm.bmType = 0;
|
||||
bm.bmWidth = bi->biWidth;
|
||||
bm.bmHeight = effHeight;
|
||||
bm.bmWidthBytes = ovr_pitch ? ovr_pitch : (ULONG) DIB_GetDIBWidthBytes(bm.bmWidth, bi->biBitCount);
|
||||
bm.bmWidthBytes = ovr_pitch ? ovr_pitch : WIDTH_BYTES_ALIGN32(bm.bmWidth, bi->biBitCount);
|
||||
|
||||
bm.bmPlanes = bi->biPlanes;
|
||||
bm.bmBitsPixel = bi->biBitCount;
|
||||
|
@ -1602,18 +1602,6 @@ DIB_GetBitmapInfo( const BITMAPINFOHEADER *header, LONG *width,
|
|||
return -1;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* DIB_GetDIBWidthBytes
|
||||
*
|
||||
* Return the width of a DIB bitmap in bytes. DIB bitmap data is 32-bit aligned.
|
||||
* http://www.microsoft.com/msdn/sdk/platforms/doc/sdk/win32/struc/src/str01.htm
|
||||
* 11/16/1999 (RJJ) lifted from wine
|
||||
*/
|
||||
INT FASTCALL DIB_GetDIBWidthBytes(INT width, INT depth)
|
||||
{
|
||||
return ((width * depth + 31) & ~31) >> 3;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* DIB_GetDIBImageBytes
|
||||
*
|
||||
|
@ -1623,7 +1611,7 @@ INT FASTCALL DIB_GetDIBWidthBytes(INT width, INT depth)
|
|||
|
||||
INT APIENTRY DIB_GetDIBImageBytes(INT width, INT height, INT depth)
|
||||
{
|
||||
return DIB_GetDIBWidthBytes(width, depth) * (height < 0 ? -height : height);
|
||||
return WIDTH_BYTES_ALIGN32(width, depth) * (height < 0 ? -height : height);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
|
Loading…
Reference in a new issue