Implement DC_bIsBitmapCompatible() helper function and use it in NtGdiSelectBitmap. Will be reused later.
[SPEC2DEF]
Improve formatting

svn path=/trunk/; revision=64426
This commit is contained in:
Timo Kreuzer 2014-09-30 21:13:57 +00:00
parent dc5a81e32e
commit c9143ec6b0
2 changed files with 25 additions and 6 deletions

View file

@ -604,7 +604,8 @@ OutputLine_def_GCC(FILE *fileDest, EXPORT *pexp)
/* 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 */

View file

@ -318,6 +318,28 @@ NtGdiSelectPen(
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 @@ NtGdiSelectBitmap(
PSURFACE psurfNew, psurfOld;
PREGION VisRgn;
HDC hdcOld;
ULONG cBitsPixel;
ASSERT_NOGDILOCKS();
/* Verify parameters */
@ -395,10 +416,7 @@ NtGdiSelectBitmap(
}
/* 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);