mirror of
https://github.com/reactos/reactos.git
synced 2025-02-23 17:05:46 +00:00
[WIN32K]
Make sure a bitmap is compatible with the dc before selecting it. svn path=/trunk/; revision=56425
This commit is contained in:
parent
05599f98f0
commit
c1dd858adc
1 changed files with 14 additions and 1 deletions
|
@ -265,6 +265,7 @@ NtGdiSelectBitmap(
|
|||
PSURFACE psurfNew, psurfOld;
|
||||
HRGN hVisRgn;
|
||||
HDC hdcOld;
|
||||
ULONG cBitsPixel;
|
||||
ASSERT_NOGDILOCKS();
|
||||
|
||||
/* Verify parameters */
|
||||
|
@ -329,6 +330,18 @@ NtGdiSelectBitmap(
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/* 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))
|
||||
{
|
||||
/* Dereference the bitmap, unlock the DC and fail. */
|
||||
SURFACE_ShareUnlockSurface(psurfNew);
|
||||
DC_UnlockDc(pdc);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Set the bitmap's hdc and check if it was set before */
|
||||
hdcOld = InterlockedCompareExchangePointer((PVOID*)&psurfNew->hdc, hdc, 0);
|
||||
if (hdcOld != NULL)
|
||||
|
@ -346,7 +359,7 @@ NtGdiSelectBitmap(
|
|||
pdc->dclevel.sizl = psurfNew->SurfObj.sizlBitmap;
|
||||
|
||||
/* Check if the bitmap is a dibsection */
|
||||
if(psurfNew->hSecure)
|
||||
if (psurfNew->hSecure)
|
||||
{
|
||||
/* Set DIBSECTION attribute */
|
||||
pdc->pdcattr->ulDirty_ |= DC_DIBSECTION;
|
||||
|
|
Loading…
Reference in a new issue