Added parameter checks.

This commit is contained in:
Armin Novak 2018-10-16 17:26:57 +02:00
parent bbcba568f4
commit 75517c06fb

View File

@ -56,7 +56,7 @@ INLINE UINT32 gdi_GetPixel(HGDI_DC hdc, UINT32 nXPos, UINT32 nYPos)
{
HGDI_BITMAP hBmp = (HGDI_BITMAP) hdc->selectedObject;
BYTE* data = &(hBmp->data[(nYPos * hBmp->scanline) + nXPos * GetBytesPerPixel(
hBmp->format)]);
hBmp->format)]);
return ReadColor(data, hBmp->format);
}
@ -80,7 +80,7 @@ static INLINE UINT32 gdi_SetPixelBmp(HGDI_BITMAP hBmp, UINT32 X, UINT32 Y,
UINT32 crColor)
{
BYTE* p = &hBmp->data[(Y * hBmp->scanline) + X * GetBytesPerPixel(
hBmp->format)];
hBmp->format)];
WriteColor(p, hBmp->format, crColor);
return crColor;
}
@ -480,9 +480,15 @@ BOOL gdi_BitBlt(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest,
switch (rop)
{
case GDI_SRCCOPY:
if (!hdcSrc)
return FALSE;
hSrcBmp = (HGDI_BITMAP) hdcSrc->selectedObject;
hDstBmp = (HGDI_BITMAP) hdcDest->selectedObject;
if (!hSrcBmp || !hDstBmp)
return FALSE;
if (!freerdp_image_copy(hDstBmp->data, hDstBmp->format, hDstBmp->scanline,
nXDest, nYDest, nWidth, nHeight,
hSrcBmp->data, hSrcBmp->format, hSrcBmp->scanline, nXSrc, nYSrc, palette, FREERDP_FLIP_NONE))
@ -494,6 +500,9 @@ BOOL gdi_BitBlt(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest,
hSrcBmp = (HGDI_BITMAP) hdcDest->selectedObject;
hDstBmp = (HGDI_BITMAP) hdcDest->selectedObject;
if (!hSrcBmp || !hDstBmp)
return FALSE;
if (!freerdp_image_copy(hDstBmp->data, hDstBmp->format, hDstBmp->scanline,
nXDest, nYDest, nWidth, nHeight,
hSrcBmp->data, hSrcBmp->format, hSrcBmp->scanline, nXSrc, nYSrc, palette, FREERDP_FLIP_NONE))