Author: jgardou
Date: Wed Sep 1 16:52:23 2010
New Revision: 48680
URL:
http://svn.reactos.org/svn/reactos?rev=48680&view=rev
Log:
[WIN32K]
- Use newly introduced macros and get rid of related functions
- Ignore alpha channels of solid brush color
Modified:
branches/reactos-yarotows/subsystems/win32/win32k/eng/bitblt.c
branches/reactos-yarotows/subsystems/win32/win32k/eng/engbrush.c
branches/reactos-yarotows/subsystems/win32/win32k/eng/engmisc.c
branches/reactos-yarotows/subsystems/win32/win32k/eng/mouse.c
branches/reactos-yarotows/subsystems/win32/win32k/include/bitmaps.h
branches/reactos-yarotows/subsystems/win32/win32k/include/dib.h
branches/reactos-yarotows/subsystems/win32/win32k/objects/bitmaps.c
branches/reactos-yarotows/subsystems/win32/win32k/objects/dibobj.c
Modified: branches/reactos-yarotows/subsystems/win32/win32k/eng/bitblt.c
URL:
http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win…
==============================================================================
--- branches/reactos-yarotows/subsystems/win32/win32k/eng/bitblt.c [iso-8859-1]
(original)
+++ branches/reactos-yarotows/subsystems/win32/win32k/eng/bitblt.c [iso-8859-1] Wed Sep 1
16:52:23 2010
@@ -158,7 +158,7 @@
// 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;
}
Modified: branches/reactos-yarotows/subsystems/win32/win32k/eng/engbrush.c
URL:
http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win…
==============================================================================
--- branches/reactos-yarotows/subsystems/win32/win32k/eng/engbrush.c [iso-8859-1]
(original)
+++ branches/reactos-yarotows/subsystems/win32/win32k/eng/engbrush.c [iso-8859-1] Wed Sep
1 16:52:23 2010
@@ -144,7 +144,7 @@
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 */
Modified: branches/reactos-yarotows/subsystems/win32/win32k/eng/engmisc.c
URL:
http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win…
==============================================================================
--- branches/reactos-yarotows/subsystems/win32/win32k/eng/engmisc.c [iso-8859-1]
(original)
+++ branches/reactos-yarotows/subsystems/win32/win32k/eng/engmisc.c [iso-8859-1] Wed Sep
1 16:52:23 2010
@@ -64,7 +64,7 @@
/* 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);
Modified: branches/reactos-yarotows/subsystems/win32/win32k/eng/mouse.c
URL:
http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win…
==============================================================================
--- branches/reactos-yarotows/subsystems/win32/win32k/eng/mouse.c [iso-8859-1] (original)
+++ branches/reactos-yarotows/subsystems/win32/win32k/eng/mouse.c [iso-8859-1] Wed Sep 1
16:52:23 2010
@@ -334,7 +334,7 @@
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. */
Modified: branches/reactos-yarotows/subsystems/win32/win32k/include/bitmaps.h
URL:
http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win…
==============================================================================
--- branches/reactos-yarotows/subsystems/win32/win32k/include/bitmaps.h [iso-8859-1]
(original)
+++ branches/reactos-yarotows/subsystems/win32/win32k/include/bitmaps.h [iso-8859-1] Wed
Sep 1 16:52:23 2010
@@ -12,7 +12,6 @@
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
Modified: branches/reactos-yarotows/subsystems/win32/win32k/include/dib.h
URL:
http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win…
==============================================================================
--- branches/reactos-yarotows/subsystems/win32/win32k/include/dib.h [iso-8859-1]
(original)
+++ branches/reactos-yarotows/subsystems/win32/win32k/include/dib.h [iso-8859-1] Wed Sep
1 16:52:23 2010
@@ -11,8 +11,6 @@
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);
Modified: branches/reactos-yarotows/subsystems/win32/win32k/objects/bitmaps.c
URL:
http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win…
==============================================================================
--- branches/reactos-yarotows/subsystems/win32/win32k/objects/bitmaps.c [iso-8859-1]
(original)
+++ branches/reactos-yarotows/subsystems/win32/win32k/objects/bitmaps.c [iso-8859-1] Wed
Sep 1 16:52:23 2010
@@ -55,7 +55,7 @@
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 @@
}
/* 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 @@
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 @@
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 @@
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 @@
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 @@
/* 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))
{
Modified: branches/reactos-yarotows/subsystems/win32/win32k/objects/dibobj.c
URL:
http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win…
==============================================================================
--- branches/reactos-yarotows/subsystems/win32/win32k/objects/dibobj.c [iso-8859-1]
(original)
+++ branches/reactos-yarotows/subsystems/win32/win32k/objects/dibobj.c [iso-8859-1] Wed
Sep 1 16:52:23 2010
@@ -480,7 +480,7 @@
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 @@
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;
@@ -1603,18 +1603,6 @@
}
/***********************************************************************
- * 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.h…
- * 11/16/1999 (RJJ) lifted from wine
- */
-INT FASTCALL DIB_GetDIBWidthBytes(INT width, INT depth)
-{
- return ((width * depth + 31) & ~31) >> 3;
-}
-
-/***********************************************************************
* DIB_GetDIBImageBytes
*
* Return the number of bytes used to hold the image in a DIB bitmap.
@@ -1623,7 +1611,7 @@
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);
}
/***********************************************************************