Added parameter checks.
This commit is contained in:
parent
bbcba568f4
commit
75517c06fb
@ -56,7 +56,7 @@ INLINE UINT32 gdi_GetPixel(HGDI_DC hdc, UINT32 nXPos, UINT32 nYPos)
|
|||||||
{
|
{
|
||||||
HGDI_BITMAP hBmp = (HGDI_BITMAP) hdc->selectedObject;
|
HGDI_BITMAP hBmp = (HGDI_BITMAP) hdc->selectedObject;
|
||||||
BYTE* data = &(hBmp->data[(nYPos * hBmp->scanline) + nXPos * GetBytesPerPixel(
|
BYTE* data = &(hBmp->data[(nYPos * hBmp->scanline) + nXPos * GetBytesPerPixel(
|
||||||
hBmp->format)]);
|
hBmp->format)]);
|
||||||
return ReadColor(data, 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)
|
UINT32 crColor)
|
||||||
{
|
{
|
||||||
BYTE* p = &hBmp->data[(Y * hBmp->scanline) + X * GetBytesPerPixel(
|
BYTE* p = &hBmp->data[(Y * hBmp->scanline) + X * GetBytesPerPixel(
|
||||||
hBmp->format)];
|
hBmp->format)];
|
||||||
WriteColor(p, hBmp->format, crColor);
|
WriteColor(p, hBmp->format, crColor);
|
||||||
return crColor;
|
return crColor;
|
||||||
}
|
}
|
||||||
@ -480,9 +480,15 @@ BOOL gdi_BitBlt(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest,
|
|||||||
switch (rop)
|
switch (rop)
|
||||||
{
|
{
|
||||||
case GDI_SRCCOPY:
|
case GDI_SRCCOPY:
|
||||||
|
if (!hdcSrc)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
hSrcBmp = (HGDI_BITMAP) hdcSrc->selectedObject;
|
hSrcBmp = (HGDI_BITMAP) hdcSrc->selectedObject;
|
||||||
hDstBmp = (HGDI_BITMAP) hdcDest->selectedObject;
|
hDstBmp = (HGDI_BITMAP) hdcDest->selectedObject;
|
||||||
|
|
||||||
|
if (!hSrcBmp || !hDstBmp)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
if (!freerdp_image_copy(hDstBmp->data, hDstBmp->format, hDstBmp->scanline,
|
if (!freerdp_image_copy(hDstBmp->data, hDstBmp->format, hDstBmp->scanline,
|
||||||
nXDest, nYDest, nWidth, nHeight,
|
nXDest, nYDest, nWidth, nHeight,
|
||||||
hSrcBmp->data, hSrcBmp->format, hSrcBmp->scanline, nXSrc, nYSrc, palette, FREERDP_FLIP_NONE))
|
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;
|
hSrcBmp = (HGDI_BITMAP) hdcDest->selectedObject;
|
||||||
hDstBmp = (HGDI_BITMAP) hdcDest->selectedObject;
|
hDstBmp = (HGDI_BITMAP) hdcDest->selectedObject;
|
||||||
|
|
||||||
|
if (!hSrcBmp || !hDstBmp)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
if (!freerdp_image_copy(hDstBmp->data, hDstBmp->format, hDstBmp->scanline,
|
if (!freerdp_image_copy(hDstBmp->data, hDstBmp->format, hDstBmp->scanline,
|
||||||
nXDest, nYDest, nWidth, nHeight,
|
nXDest, nYDest, nWidth, nHeight,
|
||||||
hSrcBmp->data, hSrcBmp->format, hSrcBmp->scanline, nXSrc, nYSrc, palette, FREERDP_FLIP_NONE))
|
hSrcBmp->data, hSrcBmp->format, hSrcBmp->scanline, nXSrc, nYSrc, palette, FREERDP_FLIP_NONE))
|
||||||
|
Loading…
Reference in New Issue
Block a user