Author: tkreuzer
Date: Tue Sep 30 21:13:57 2014
New Revision: 64426
URL:
http://svn.reactos.org/svn/reactos?rev=64426&view=rev
Log:
[WIN32K]
Implement DC_bIsBitmapCompatible() helper function and use it in NtGdiSelectBitmap. Will
be reused later.
[SPEC2DEF]
Improve formatting
Modified:
trunk/reactos/tools/spec2def/spec2def.c
trunk/reactos/win32ss/gdi/ntgdi/dcobjs.c
Modified: trunk/reactos/tools/spec2def/spec2def.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/spec2def/spec2def.c?…
==============================================================================
--- trunk/reactos/tools/spec2def/spec2def.c [iso-8859-1] (original)
+++ trunk/reactos/tools/spec2def/spec2def.c [iso-8859-1] Tue Sep 30 21:13:57 2014
@@ -604,7 +604,8 @@
/* C++ stubs are forwarded to C stubs */
fprintf(fileDest, "=stub_function%d", pexp->nNumber);
}
- else if (gbTracing && ((pexp->uFlags & FL_NORELAY) == 0) &&
(pexp->nCallingConvention == CC_STDCALL) &&
+ else if (gbTracing && ((pexp->uFlags & FL_NORELAY) == 0) &&
+ (pexp->nCallingConvention == CC_STDCALL) &&
(pexp->strName.buf[0] != '?'))
{
/* Redirect it to the relay-tracing trampoline */
Modified: trunk/reactos/win32ss/gdi/ntgdi/dcobjs.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/dcobjs.c…
==============================================================================
--- trunk/reactos/win32ss/gdi/ntgdi/dcobjs.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/ntgdi/dcobjs.c [iso-8859-1] Tue Sep 30 21:13:57 2014
@@ -318,6 +318,28 @@
return hOrgPen;
}
+BOOL
+NTAPI
+DC_bIsBitmapCompatible(PDC pdc, PSURFACE psurf)
+{
+ ULONG cBitsPixel;
+
+ /* Must be an API bitmap */
+ if (!(psurf->flags & API_BITMAP)) return FALSE;
+
+ /* DIB sections are always compatible */
+ if (psurf->hSecure != NULL) return TRUE;
+
+ /* Get the bit depth of the bitmap */
+ cBitsPixel = gajBitsPerFormat[psurf->SurfObj.iBitmapFormat];
+
+ /* 1 BPP is compatible */
+ if ((cBitsPixel == 1) || (cBitsPixel == pdc->ppdev->gdiinfo.cBitsPixel))
+ return TRUE;
+
+ return FALSE;
+}
+
/*
* @implemented
*/
@@ -332,7 +354,6 @@
PSURFACE psurfNew, psurfOld;
PREGION VisRgn;
HDC hdcOld;
- ULONG cBitsPixel;
ASSERT_NOGDILOCKS();
/* Verify parameters */
@@ -395,10 +416,7 @@
}
/* Check if the bitmap is compatile with the dc */
- cBitsPixel = gajBitsPerFormat[psurfNew->SurfObj.iBitmapFormat];
- if ((cBitsPixel != 1) &&
- (cBitsPixel != pdc->ppdev->gdiinfo.cBitsPixel) &&
- (psurfNew->hSecure == NULL))
+ if (!DC_bIsBitmapCompatible(pdc, psurfNew))
{
/* Dereference the bitmap, unlock the DC and fail. */
SURFACE_ShareUnlockSurface(psurfNew);