mirror of
https://github.com/reactos/reactos.git
synced 2024-10-06 09:24:11 +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
|
@ -265,6 +265,7 @@ NtGdiSelectBitmap(
|
||||||
PSURFACE psurfNew, psurfOld;
|
PSURFACE psurfNew, psurfOld;
|
||||||
HRGN hVisRgn;
|
HRGN hVisRgn;
|
||||||
HDC hdcOld;
|
HDC hdcOld;
|
||||||
|
ULONG cBitsPixel;
|
||||||
ASSERT_NOGDILOCKS();
|
ASSERT_NOGDILOCKS();
|
||||||
|
|
||||||
/* Verify parameters */
|
/* Verify parameters */
|
||||||
|
@ -329,6 +330,18 @@ NtGdiSelectBitmap(
|
||||||
return NULL;
|
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 */
|
/* Set the bitmap's hdc and check if it was set before */
|
||||||
hdcOld = InterlockedCompareExchangePointer((PVOID*)&psurfNew->hdc, hdc, 0);
|
hdcOld = InterlockedCompareExchangePointer((PVOID*)&psurfNew->hdc, hdc, 0);
|
||||||
if (hdcOld != NULL)
|
if (hdcOld != NULL)
|
||||||
|
@ -346,7 +359,7 @@ NtGdiSelectBitmap(
|
||||||
pdc->dclevel.sizl = psurfNew->SurfObj.sizlBitmap;
|
pdc->dclevel.sizl = psurfNew->SurfObj.sizlBitmap;
|
||||||
|
|
||||||
/* Check if the bitmap is a dibsection */
|
/* Check if the bitmap is a dibsection */
|
||||||
if(psurfNew->hSecure)
|
if (psurfNew->hSecure)
|
||||||
{
|
{
|
||||||
/* Set DIBSECTION attribute */
|
/* Set DIBSECTION attribute */
|
||||||
pdc->pdcattr->ulDirty_ |= DC_DIBSECTION;
|
pdc->pdcattr->ulDirty_ |= DC_DIBSECTION;
|
||||||
|
|
Loading…
Reference in a new issue