diff --git a/client/common/cmdline.c b/client/common/cmdline.c index 65087ab38..b4d63a535 100644 --- a/client/common/cmdline.c +++ b/client/common/cmdline.c @@ -968,7 +968,6 @@ int freerdp_client_command_line_post_filter(void* context, COMMAND_LINE_ARGUMENT int freerdp_parse_username(char* username, char** user, char** domain) { char* p; - char* u; int length = 0; p = strchr(username, '\\'); diff --git a/include/freerdp/gdi/16bpp.h b/include/freerdp/gdi/16bpp.h index afa10d2da..8193c86fe 100644 --- a/include/freerdp/gdi/16bpp.h +++ b/include/freerdp/gdi/16bpp.h @@ -24,7 +24,7 @@ #include #include -typedef int (*pLineTo_16bpp)(HGDI_DC hdc, int nXEnd, int nYEnd); +typedef BOOL (*pLineTo_16bpp)(HGDI_DC hdc, int nXEnd, int nYEnd); #ifdef __cplusplus extern "C" { @@ -32,10 +32,10 @@ typedef int (*pLineTo_16bpp)(HGDI_DC hdc, int nXEnd, int nYEnd); FREERDP_API UINT16 gdi_get_color_16bpp(HGDI_DC hdc, GDI_COLOR color); -FREERDP_API int FillRect_16bpp(HGDI_DC hdc, HGDI_RECT rect, HGDI_BRUSH hbr); -FREERDP_API int BitBlt_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc, int rop); -FREERDP_API int PatBlt_16bpp(HGDI_DC hdc, int nXLeft, int nYLeft, int nWidth, int nHeight, int rop); -FREERDP_API int LineTo_16bpp(HGDI_DC hdc, int nXEnd, int nYEnd); +FREERDP_API BOOL FillRect_16bpp(HGDI_DC hdc, HGDI_RECT rect, HGDI_BRUSH hbr); +FREERDP_API BOOL BitBlt_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc, DWORD rop); +FREERDP_API BOOL PatBlt_16bpp(HGDI_DC hdc, int nXLeft, int nYLeft, int nWidth, int nHeight, DWORD rop); +FREERDP_API BOOL LineTo_16bpp(HGDI_DC hdc, int nXEnd, int nYEnd); #ifdef __cplusplus } diff --git a/include/freerdp/gdi/32bpp.h b/include/freerdp/gdi/32bpp.h index cb9139701..89a39863c 100644 --- a/include/freerdp/gdi/32bpp.h +++ b/include/freerdp/gdi/32bpp.h @@ -24,7 +24,7 @@ #include #include -typedef int (*pLineTo_32bpp)(HGDI_DC hdc, int nXEnd, int nYEnd); +typedef BOOL (*pLineTo_32bpp)(HGDI_DC hdc, int nXEnd, int nYEnd); #ifdef __cplusplus extern "C" { @@ -32,10 +32,10 @@ typedef int (*pLineTo_32bpp)(HGDI_DC hdc, int nXEnd, int nYEnd); FREERDP_API UINT32 gdi_get_color_32bpp(HGDI_DC hdc, GDI_COLOR color); -FREERDP_API int FillRect_32bpp(HGDI_DC hdc, HGDI_RECT rect, HGDI_BRUSH hbr); -FREERDP_API int BitBlt_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc, int rop); -FREERDP_API int PatBlt_32bpp(HGDI_DC hdc, int nXLeft, int nYLeft, int nWidth, int nHeight, int rop); -FREERDP_API int LineTo_32bpp(HGDI_DC hdc, int nXEnd, int nYEnd); +FREERDP_API BOOL FillRect_32bpp(HGDI_DC hdc, HGDI_RECT rect, HGDI_BRUSH hbr); +FREERDP_API BOOL BitBlt_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc, DWORD rop); +FREERDP_API BOOL PatBlt_32bpp(HGDI_DC hdc, int nXLeft, int nYLeft, int nWidth, int nHeight, DWORD rop); +FREERDP_API BOOL LineTo_32bpp(HGDI_DC hdc, int nXEnd, int nYEnd); #ifdef __cplusplus } diff --git a/include/freerdp/gdi/8bpp.h b/include/freerdp/gdi/8bpp.h index b609eacd0..52f09bf87 100644 --- a/include/freerdp/gdi/8bpp.h +++ b/include/freerdp/gdi/8bpp.h @@ -24,7 +24,7 @@ #include #include -typedef int (*pLineTo_8bpp)(HGDI_DC hdc, int nXEnd, int nYEnd); +typedef BOOL (*pLineTo_8bpp)(HGDI_DC hdc, int nXEnd, int nYEnd); #ifdef __cplusplus extern "C" { @@ -32,10 +32,10 @@ typedef int (*pLineTo_8bpp)(HGDI_DC hdc, int nXEnd, int nYEnd); FREERDP_API BYTE gdi_get_color_8bpp(HGDI_DC hdc, GDI_COLOR color); -FREERDP_API int FillRect_8bpp(HGDI_DC hdc, HGDI_RECT rect, HGDI_BRUSH hbr); -FREERDP_API int BitBlt_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc, int rop); -FREERDP_API int PatBlt_8bpp(HGDI_DC hdc, int nXLeft, int nYLeft, int nWidth, int nHeight, int rop); -FREERDP_API int LineTo_8bpp(HGDI_DC hdc, int nXEnd, int nYEnd); +FREERDP_API BOOL FillRect_8bpp(HGDI_DC hdc, HGDI_RECT rect, HGDI_BRUSH hbr); +FREERDP_API BOOL BitBlt_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc, DWORD rop); +FREERDP_API BOOL PatBlt_8bpp(HGDI_DC hdc, int nXLeft, int nYLeft, int nWidth, int nHeight, DWORD rop); +FREERDP_API BOOL LineTo_8bpp(HGDI_DC hdc, int nXEnd, int nYEnd); #ifdef __cplusplus } diff --git a/include/freerdp/gdi/bitmap.h b/include/freerdp/gdi/bitmap.h index c34713c6c..42caf0b13 100644 --- a/include/freerdp/gdi/bitmap.h +++ b/include/freerdp/gdi/bitmap.h @@ -40,9 +40,9 @@ FREERDP_API void gdi_SetPixel_16bpp(HGDI_BITMAP hBmp, int X, int Y, UINT16 pixel FREERDP_API void gdi_SetPixel_32bpp(HGDI_BITMAP hBmp, int X, int Y, UINT32 pixel); FREERDP_API HGDI_BITMAP gdi_CreateBitmap(int nWidth, int nHeight, int cBitsPerPixel, BYTE* data); FREERDP_API HGDI_BITMAP gdi_CreateCompatibleBitmap(HGDI_DC hdc, int nWidth, int nHeight); -FREERDP_API int gdi_BitBlt(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc, int rop); +FREERDP_API BOOL gdi_BitBlt(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc, DWORD rop); -typedef int (*p_BitBlt)(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc, int rop); +typedef BOOL (*p_BitBlt)(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc, DWORD rop); #ifdef __cplusplus } diff --git a/include/freerdp/gdi/brush.h b/include/freerdp/gdi/brush.h index 5313664a8..6817c3949 100644 --- a/include/freerdp/gdi/brush.h +++ b/include/freerdp/gdi/brush.h @@ -30,12 +30,12 @@ FREERDP_API HGDI_BRUSH gdi_CreateSolidBrush(GDI_COLOR crColor); FREERDP_API HGDI_BRUSH gdi_CreatePatternBrush(HGDI_BITMAP hbmp); FREERDP_API HGDI_BRUSH gdi_CreateHatchBrush(HGDI_BITMAP hbmp); -FREERDP_API int gdi_PatBlt(HGDI_DC hdc, int nXLeft, int nYLeft, int nWidth, int nHeight, int rop); +FREERDP_API BOOL gdi_PatBlt(HGDI_DC hdc, int nXLeft, int nYLeft, int nWidth, int nHeight, DWORD rop); #ifdef __cplusplus } #endif -typedef int (*p_PatBlt)(HGDI_DC hdc, int nXLeft, int nYLeft, int nWidth, int nHeight, int rop); +typedef BOOL (*p_PatBlt)(HGDI_DC hdc, int nXLeft, int nYLeft, int nWidth, int nHeight, DWORD rop); #endif /* FREERDP_GDI_BRUSH_H */ diff --git a/include/freerdp/gdi/clipping.h b/include/freerdp/gdi/clipping.h index 75470f6e8..eb8dec39f 100644 --- a/include/freerdp/gdi/clipping.h +++ b/include/freerdp/gdi/clipping.h @@ -27,10 +27,10 @@ extern "C" { #endif -FREERDP_API int gdi_SetClipRgn(HGDI_DC hdc, int nXLeft, int nYLeft, int nWidth, int nHeight); +FREERDP_API BOOL gdi_SetClipRgn(HGDI_DC hdc, int nXLeft, int nYLeft, int nWidth, int nHeight); FREERDP_API HGDI_RGN gdi_GetClipRgn(HGDI_DC hdc); -FREERDP_API int gdi_SetNullClipRgn(HGDI_DC hdc); -FREERDP_API int gdi_ClipCoords(HGDI_DC hdc, int *x, int *y, int *w, int *h, int *srcx, int *srcy); +FREERDP_API BOOL gdi_SetNullClipRgn(HGDI_DC hdc); +FREERDP_API BOOL gdi_ClipCoords(HGDI_DC hdc, int *x, int *y, int *w, int *h, int *srcx, int *srcy); #ifdef __cplusplus } diff --git a/include/freerdp/gdi/dc.h b/include/freerdp/gdi/dc.h index 5c66903a6..ceca9d0b5 100644 --- a/include/freerdp/gdi/dc.h +++ b/include/freerdp/gdi/dc.h @@ -31,8 +31,8 @@ FREERDP_API HGDI_DC gdi_GetDC(void); FREERDP_API HGDI_DC gdi_CreateDC(UINT32 flags, int bpp); FREERDP_API HGDI_DC gdi_CreateCompatibleDC(HGDI_DC hdc); FREERDP_API HGDIOBJECT gdi_SelectObject(HGDI_DC hdc, HGDIOBJECT hgdiobject); -FREERDP_API int gdi_DeleteObject(HGDIOBJECT hgdiobject); -FREERDP_API int gdi_DeleteDC(HGDI_DC hdc); +FREERDP_API BOOL gdi_DeleteObject(HGDIOBJECT hgdiobject); +FREERDP_API BOOL gdi_DeleteDC(HGDI_DC hdc); #ifdef __cplusplus } diff --git a/include/freerdp/gdi/gdi.h b/include/freerdp/gdi/gdi.h index d640d973f..9736ba724 100644 --- a/include/freerdp/gdi/gdi.h +++ b/include/freerdp/gdi/gdi.h @@ -315,7 +315,7 @@ struct rdp_gdi extern "C" { #endif -FREERDP_API UINT32 gdi_rop3_code(BYTE code); +FREERDP_API DWORD gdi_rop3_code(BYTE code); FREERDP_API UINT32 gdi_get_pixel_format(UINT32 bitsPerPixel, BOOL vFlip); FREERDP_API BYTE* gdi_get_bitmap_pointer(HGDI_DC hdcBmp, int x, int y); FREERDP_API BYTE* gdi_get_brush_pointer(HGDI_DC hdcBrush, int x, int y); diff --git a/include/freerdp/gdi/line.h b/include/freerdp/gdi/line.h index 18014cfd5..daf8b8b59 100644 --- a/include/freerdp/gdi/line.h +++ b/include/freerdp/gdi/line.h @@ -27,16 +27,16 @@ extern "C" { #endif -FREERDP_API int gdi_LineTo(HGDI_DC hdc, int nXEnd, int nYEnd); -FREERDP_API int gdi_PolylineTo(HGDI_DC hdc, GDI_POINT *lppt, int cCount); -FREERDP_API int gdi_Polyline(HGDI_DC hdc, GDI_POINT *lppt, int cPoints); -FREERDP_API int gdi_PolyPolyline(HGDI_DC hdc, GDI_POINT *lppt, int *lpdwPolyPoints, int cCount); -FREERDP_API int gdi_MoveToEx(HGDI_DC hdc, int X, int Y, HGDI_POINT lpPoint); +FREERDP_API BOOL gdi_LineTo(HGDI_DC hdc, int nXEnd, int nYEnd); +FREERDP_API BOOL gdi_PolylineTo(HGDI_DC hdc, GDI_POINT *lppt, DWORD cCount); +FREERDP_API BOOL gdi_Polyline(HGDI_DC hdc, GDI_POINT *lppt, int cPoints); +FREERDP_API BOOL gdi_PolyPolyline(HGDI_DC hdc, GDI_POINT *lppt, int *lpdwPolyPoints, DWORD cCount); +FREERDP_API BOOL gdi_MoveToEx(HGDI_DC hdc, int X, int Y, HGDI_POINT lpPoint); #ifdef __cplusplus } #endif -typedef int (*p_LineTo)(HGDI_DC hdc, int nXEnd, int nYEnd); +typedef BOOL (*p_LineTo)(HGDI_DC hdc, int nXEnd, int nYEnd); #endif /* FREERDP_GDI_LINE_H */ diff --git a/include/freerdp/gdi/region.h b/include/freerdp/gdi/region.h index e57726352..8ef56aa8c 100644 --- a/include/freerdp/gdi/region.h +++ b/include/freerdp/gdi/region.h @@ -37,13 +37,13 @@ FREERDP_API void gdi_RgnToRect(HGDI_RGN rgn, HGDI_RECT rect); FREERDP_API void gdi_CRgnToRect(int x, int y, int w, int h, HGDI_RECT rect); FREERDP_API void gdi_RgnToCRect(HGDI_RGN rgn, int *left, int *top, int *right, int *bottom); FREERDP_API void gdi_CRgnToCRect(int x, int y, int w, int h, int *left, int *top, int *right, int *bottom); -FREERDP_API int gdi_CopyOverlap(int x, int y, int width, int height, int srcx, int srcy); -FREERDP_API int gdi_SetRect(HGDI_RECT rc, int xLeft, int yTop, int xRight, int yBottom); -FREERDP_API int gdi_SetRgn(HGDI_RGN hRgn, int nXLeft, int nYLeft, int nWidth, int nHeight); -FREERDP_API int gdi_SetRectRgn(HGDI_RGN hRgn, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect); -FREERDP_API int gdi_EqualRgn(HGDI_RGN hSrcRgn1, HGDI_RGN hSrcRgn2); -FREERDP_API int gdi_CopyRect(HGDI_RECT dst, HGDI_RECT src); -FREERDP_API int gdi_PtInRect(HGDI_RECT rc, int x, int y); +FREERDP_API BOOL gdi_CopyOverlap(int x, int y, int width, int height, int srcx, int srcy); +FREERDP_API BOOL gdi_SetRect(HGDI_RECT rc, int xLeft, int yTop, int xRight, int yBottom); +FREERDP_API BOOL gdi_SetRgn(HGDI_RGN hRgn, int nXLeft, int nYLeft, int nWidth, int nHeight); +FREERDP_API BOOL gdi_SetRectRgn(HGDI_RGN hRgn, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect); +FREERDP_API BOOL gdi_EqualRgn(HGDI_RGN hSrcRgn1, HGDI_RGN hSrcRgn2); +FREERDP_API BOOL gdi_CopyRect(HGDI_RECT dst, HGDI_RECT src); +FREERDP_API BOOL gdi_PtInRect(HGDI_RECT rc, int x, int y); FREERDP_API BOOL gdi_InvalidateRegion(HGDI_DC hdc, int x, int y, int w, int h); #ifdef __cplusplus diff --git a/include/freerdp/gdi/shape.h b/include/freerdp/gdi/shape.h index 9b96324dd..95bbbe567 100644 --- a/include/freerdp/gdi/shape.h +++ b/include/freerdp/gdi/shape.h @@ -27,13 +27,13 @@ extern "C" { #endif -FREERDP_API int gdi_Ellipse(HGDI_DC hdc, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect); -FREERDP_API int gdi_FillRect(HGDI_DC hdc, HGDI_RECT rect, HGDI_BRUSH hbr); -FREERDP_API int gdi_Polygon(HGDI_DC hdc, GDI_POINT *lpPoints, int nCount); -FREERDP_API int gdi_PolyPolygon(HGDI_DC hdc, GDI_POINT *lpPoints, int *lpPolyCounts, int nCount); -FREERDP_API int gdi_Rectangle(HGDI_DC hdc, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect); +FREERDP_API BOOL gdi_Ellipse(HGDI_DC hdc, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect); +FREERDP_API BOOL gdi_FillRect(HGDI_DC hdc, HGDI_RECT rect, HGDI_BRUSH hbr); +FREERDP_API BOOL gdi_Polygon(HGDI_DC hdc, GDI_POINT *lpPoints, int nCount); +FREERDP_API BOOL gdi_PolyPolygon(HGDI_DC hdc, GDI_POINT *lpPoints, int *lpPolyCounts, int nCount); +FREERDP_API BOOL gdi_Rectangle(HGDI_DC hdc, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect); -typedef int (*p_FillRect)(HGDI_DC hdc, HGDI_RECT rect, HGDI_BRUSH hbr); +typedef BOOL (*p_FillRect)(HGDI_DC hdc, HGDI_RECT rect, HGDI_BRUSH hbr); #ifdef __cplusplus } diff --git a/libfreerdp/gdi/16bpp.c b/libfreerdp/gdi/16bpp.c index ab8836712..1ee8a0f6b 100644 --- a/libfreerdp/gdi/16bpp.c +++ b/libfreerdp/gdi/16bpp.c @@ -74,7 +74,7 @@ UINT16 gdi_get_color_16bpp(HGDI_DC hdc, GDI_COLOR color) return color16; } -int FillRect_16bpp(HGDI_DC hdc, HGDI_RECT rect, HGDI_BRUSH hbr) +BOOL FillRect_16bpp(HGDI_DC hdc, HGDI_RECT rect, HGDI_BRUSH hbr) { int x, y; UINT16 *dstp; @@ -85,8 +85,8 @@ int FillRect_16bpp(HGDI_DC hdc, HGDI_RECT rect, HGDI_BRUSH hbr) gdi_RectToCRgn(rect, &nXDest, &nYDest, &nWidth, &nHeight); - if (gdi_ClipCoords(hdc, &nXDest, &nYDest, &nWidth, &nHeight, NULL, NULL) == 0) - return 1; + if (!gdi_ClipCoords(hdc, &nXDest, &nYDest, &nWidth, &nHeight, NULL, NULL)) + return TRUE; color16 = gdi_get_color_16bpp(hdc, hbr->color); @@ -105,11 +105,12 @@ int FillRect_16bpp(HGDI_DC hdc, HGDI_RECT rect, HGDI_BRUSH hbr) } if (!gdi_InvalidateRegion(hdc, nXDest, nYDest, nWidth, nHeight)) - return 0; - return 1; + return FALSE; + + return TRUE; } -static int BitBlt_BLACKNESS_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight) +static BOOL BitBlt_BLACKNESS_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight) { int y; BYTE* dstp; @@ -122,10 +123,10 @@ static int BitBlt_BLACKNESS_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int n memset(dstp, 0, nWidth * hdcDest->bytesPerPixel); } - return 1; + return TRUE; } -static int BitBlt_WHITENESS_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight) +static BOOL BitBlt_WHITENESS_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight) { int y; BYTE* dstp; @@ -138,20 +139,20 @@ static int BitBlt_WHITENESS_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int n memset(dstp, 0xFF, nWidth * hdcDest->bytesPerPixel); } - return 1; + return TRUE; } -static int BitBlt_SRCCOPY_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) +static BOOL BitBlt_SRCCOPY_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int y; BYTE* srcp; BYTE* dstp; if (!hdcSrc || !hdcDest) - return 0; + return FALSE; if ((hdcDest->selectedObject != hdcSrc->selectedObject) || - gdi_CopyOverlap(nXDest, nYDest, nWidth, nHeight, nXSrc, nYSrc) == 0) + !gdi_CopyOverlap(nXDest, nYDest, nWidth, nHeight, nXSrc, nYSrc)) { for (y = 0; y < nHeight; y++) { @@ -162,7 +163,7 @@ static int BitBlt_SRCCOPY_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi memcpy(dstp, srcp, nWidth * hdcDest->bytesPerPixel); } - return 1; + return TRUE; } if (nYSrc < nYDest) @@ -202,17 +203,17 @@ static int BitBlt_SRCCOPY_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi } } - return 1; + return TRUE; } -static int BitBlt_NOTSRCCOPY_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) +static BOOL BitBlt_NOTSRCCOPY_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; UINT16* srcp; UINT16* dstp; if (!hdcSrc || !hdcDest) - return 0; + return FALSE; for (y = 0; y < nHeight; y++) { @@ -230,10 +231,10 @@ static int BitBlt_NOTSRCCOPY_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int } } - return 1; + return TRUE; } -static int BitBlt_DSTINVERT_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight) +static BOOL BitBlt_DSTINVERT_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight) { int x, y; UINT16* dstp; @@ -252,17 +253,17 @@ static int BitBlt_DSTINVERT_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int n } } - return 1; + return TRUE; } -static int BitBlt_SRCERASE_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) +static BOOL BitBlt_SRCERASE_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; UINT16* srcp; UINT16* dstp; if (!hdcSrc || !hdcDest) - return 0; + return FALSE; for (y = 0; y < nHeight; y++) { @@ -280,17 +281,17 @@ static int BitBlt_SRCERASE_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nW } } - return 1; + return TRUE; } -static int BitBlt_NOTSRCERASE_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) +static BOOL BitBlt_NOTSRCERASE_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; UINT16* srcp; UINT16* dstp; if (!hdcSrc || !hdcDest) - return 0; + return FALSE; for (y = 0; y < nHeight; y++) { @@ -308,17 +309,17 @@ static int BitBlt_NOTSRCERASE_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int } } - return 1; + return TRUE; } -static int BitBlt_SRCINVERT_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) +static BOOL BitBlt_SRCINVERT_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; UINT16* srcp; UINT16* dstp; if (!hdcSrc || !hdcDest) - return 0; + return FALSE; for (y = 0; y < nHeight; y++) { @@ -336,17 +337,17 @@ static int BitBlt_SRCINVERT_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int n } } - return 1; + return TRUE; } -static int BitBlt_SRCAND_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) +static BOOL BitBlt_SRCAND_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; UINT16* srcp; UINT16* dstp; if (!hdcSrc || !hdcDest) - return 0; + return FALSE; for (y = 0; y < nHeight; y++) { @@ -364,17 +365,17 @@ static int BitBlt_SRCAND_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWid } } - return 1; + return TRUE; } -static int BitBlt_SRCPAINT_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) +static BOOL BitBlt_SRCPAINT_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; UINT16* srcp; UINT16* dstp; if (!hdcSrc || !hdcDest) - return 0; + return FALSE; for (y = 0; y < nHeight; y++) { @@ -392,10 +393,10 @@ static int BitBlt_SRCPAINT_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nW } } - return 1; + return TRUE; } -static int BitBlt_DSPDxax_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) +static BOOL BitBlt_DSPDxax_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; BYTE* srcp; @@ -405,7 +406,7 @@ static int BitBlt_DSPDxax_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi HGDI_BITMAP hSrcBmp; if (!hdcDest || !hdcSrc) - return 0; + return FALSE; /* D = (S & P) | (~S & D) */ /* DSPDxax, used to draw glyphs */ @@ -418,7 +419,7 @@ static int BitBlt_DSPDxax_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi { WLog_ERR(TAG, "BitBlt_DSPDxax expects 1 bpp, unimplemented for %d", hdcSrc->bytesPerPixel); - return 0; + return FALSE; } for (y = 0; y < nHeight; y++) @@ -438,10 +439,10 @@ static int BitBlt_DSPDxax_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi } } - return 1; + return TRUE; } -static int BitBlt_PSDPxax_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) +static BOOL BitBlt_PSDPxax_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; UINT16* srcp; @@ -450,7 +451,7 @@ static int BitBlt_PSDPxax_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi UINT16 color16; if (!hdcSrc || !hdcDest) - return 0; + return FALSE; /* D = (S & D) | (~S & P) */ @@ -495,10 +496,10 @@ static int BitBlt_PSDPxax_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi } } - return 1; + return TRUE; } -static int BitBlt_SPna_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) +static BOOL BitBlt_SPna_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; UINT16* srcp; @@ -506,7 +507,7 @@ static int BitBlt_SPna_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth UINT16* patp; if (!hdcSrc || !hdcDest) - return 0; + return FALSE; for (y = 0; y < nHeight; y++) { @@ -525,10 +526,10 @@ static int BitBlt_SPna_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth } } - return 1; + return TRUE; } -static int BitBlt_DPa_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight) +static BOOL BitBlt_DPa_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight) { int x, y; UINT16* dstp; @@ -550,10 +551,10 @@ static int BitBlt_DPa_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, } } - return 1; + return TRUE; } -static int BitBlt_PDxn_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight) +static BOOL BitBlt_PDxn_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight) { int x, y; UINT16* dstp; @@ -574,17 +575,17 @@ static int BitBlt_PDxn_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth } } - return 1; + return TRUE; } -static int BitBlt_DSna_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) +static BOOL BitBlt_DSna_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; UINT16* srcp; UINT16* dstp; if (!hdcSrc || !hdcDest) - return 0; + return FALSE; for (y = 0; y < nHeight; y++) { @@ -602,11 +603,11 @@ static int BitBlt_DSna_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth } } - return 1; + return TRUE; } -static int BitBlt_MERGECOPY_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) +static BOOL BitBlt_MERGECOPY_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; UINT16* srcp; @@ -614,7 +615,7 @@ static int BitBlt_MERGECOPY_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int n UINT16* patp; if (!hdcSrc || !hdcDest) - return 0; + return FALSE; for (y = 0; y < nHeight; y++) { @@ -633,17 +634,17 @@ static int BitBlt_MERGECOPY_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int n } } - return 1; + return TRUE; } -static int BitBlt_MERGEPAINT_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) +static BOOL BitBlt_MERGEPAINT_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; UINT16* srcp; UINT16* dstp; if (!hdcSrc || !hdcDest) - return 0; + return FALSE; for (y = 0; y < nHeight; y++) { @@ -661,10 +662,10 @@ static int BitBlt_MERGEPAINT_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int } } - return 1; + return TRUE; } -static int BitBlt_PATCOPY_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight) +static BOOL BitBlt_PATCOPY_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight) { int x, y, xOffset, yOffset; UINT16* dstp; @@ -720,10 +721,10 @@ static int BitBlt_PATCOPY_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi } } - return 1; + return TRUE; } -static int BitBlt_PATINVERT_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight) +static BOOL BitBlt_PATINVERT_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight) { int x, y; UINT16* dstp; @@ -766,10 +767,10 @@ static int BitBlt_PATINVERT_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int n } } - return 1; + return TRUE; } -static int BitBlt_PATPAINT_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) +static BOOL BitBlt_PATPAINT_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; UINT16* srcp; @@ -777,7 +778,7 @@ static int BitBlt_PATPAINT_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nW UINT16* patp; if (!hdcSrc || !hdcDest) - return 0; + return FALSE; for (y = 0; y < nHeight; y++) { @@ -796,27 +797,27 @@ static int BitBlt_PATPAINT_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nW } } - return 1; + return TRUE; } -int BitBlt_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc, int rop) +BOOL BitBlt_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc, DWORD rop) { if (!hdcDest) - return 0; + return FALSE; if (hdcSrc != NULL) { - if (gdi_ClipCoords(hdcDest, &nXDest, &nYDest, &nWidth, &nHeight, &nXSrc, &nYSrc) == 0) - return 1; + if (!gdi_ClipCoords(hdcDest, &nXDest, &nYDest, &nWidth, &nHeight, &nXSrc, &nYSrc)) + return TRUE; } else { - if (gdi_ClipCoords(hdcDest, &nXDest, &nYDest, &nWidth, &nHeight, NULL, NULL) == 0) - return 1; + if (!gdi_ClipCoords(hdcDest, &nXDest, &nYDest, &nWidth, &nHeight, NULL, NULL)) + return TRUE; } if (!gdi_InvalidateRegion(hdcDest, nXDest, nYDest, nWidth, nHeight)) - return 0; + return FALSE; switch (rop) { @@ -879,16 +880,16 @@ int BitBlt_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeigh } WLog_ERR(TAG, "BitBlt: unknown rop: 0x%08X", rop); - return 1; + return FALSE; } -int PatBlt_16bpp(HGDI_DC hdc, int nXLeft, int nYLeft, int nWidth, int nHeight, int rop) +BOOL PatBlt_16bpp(HGDI_DC hdc, int nXLeft, int nYLeft, int nWidth, int nHeight, DWORD rop) { - if (gdi_ClipCoords(hdc, &nXLeft, &nYLeft, &nWidth, &nHeight, NULL, NULL) == 0) - return 1; + if (!gdi_ClipCoords(hdc, &nXLeft, &nYLeft, &nWidth, &nHeight, NULL, NULL)) + return TRUE; if (!gdi_InvalidateRegion(hdc, nXLeft, nYLeft, nWidth, nHeight)) - return 0; + return FALSE; switch (rop) { @@ -918,7 +919,7 @@ int PatBlt_16bpp(HGDI_DC hdc, int nXLeft, int nYLeft, int nWidth, int nHeight, i } WLog_ERR(TAG, "PatBlt: unknown rop: 0x%08X", rop); - return 1; + return FALSE; } static INLINE void SetPixel_BLACK_16bpp(UINT16 *pixel, UINT16 *pen) @@ -1140,15 +1141,15 @@ pLineTo_16bpp LineTo_ROP2_16bpp[32] = LineTo_WHITE_16bpp }; -int LineTo_16bpp(HGDI_DC hdc, int nXEnd, int nYEnd) +BOOL LineTo_16bpp(HGDI_DC hdc, int nXEnd, int nYEnd) { pLineTo_16bpp _LineTo; int rop2 = gdi_GetROP2(hdc) - 1; _LineTo = LineTo_ROP2_16bpp[rop2]; - if (_LineTo != NULL) - return _LineTo(hdc, nXEnd, nYEnd); - else - return 0; + if (_LineTo == NULL) + return FALSE; + + return _LineTo(hdc, nXEnd, nYEnd); } diff --git a/libfreerdp/gdi/32bpp.c b/libfreerdp/gdi/32bpp.c index 55b3761a4..f9124bbae 100644 --- a/libfreerdp/gdi/32bpp.c +++ b/libfreerdp/gdi/32bpp.c @@ -61,7 +61,7 @@ UINT32 gdi_get_color_32bpp(HGDI_DC hdc, GDI_COLOR color) return color32; } -int FillRect_32bpp(HGDI_DC hdc, HGDI_RECT rect, HGDI_BRUSH hbr) +BOOL FillRect_32bpp(HGDI_DC hdc, HGDI_RECT rect, HGDI_BRUSH hbr) { int x, y; UINT32 *dstp; @@ -71,8 +71,8 @@ int FillRect_32bpp(HGDI_DC hdc, HGDI_RECT rect, HGDI_BRUSH hbr) gdi_RectToCRgn(rect, &nXDest, &nYDest, &nWidth, &nHeight); - if (gdi_ClipCoords(hdc, &nXDest, &nYDest, &nWidth, &nHeight, NULL, NULL) == 0) - return 1; + if (!gdi_ClipCoords(hdc, &nXDest, &nYDest, &nWidth, &nHeight, NULL, NULL)) + return TRUE; color32 = gdi_get_color_32bpp(hdc, hbr->color); @@ -91,11 +91,12 @@ int FillRect_32bpp(HGDI_DC hdc, HGDI_RECT rect, HGDI_BRUSH hbr) } if (!gdi_InvalidateRegion(hdc, nXDest, nYDest, nWidth, nHeight)) - return 0; - return 1; + return FALSE; + + return TRUE; } -static int BitBlt_BLACKNESS_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight) +static BOOL BitBlt_BLACKNESS_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight) { if (hdcDest->alpha) { @@ -139,10 +140,10 @@ static int BitBlt_BLACKNESS_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int n } } - return 1; + return TRUE; } -static int BitBlt_WHITENESS_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight) +static BOOL BitBlt_WHITENESS_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight) { int y; BYTE* dstp; @@ -155,20 +156,20 @@ static int BitBlt_WHITENESS_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int n memset(dstp, 0xFF, nWidth * hdcDest->bytesPerPixel); } - return 1; + return TRUE; } -static int BitBlt_SRCCOPY_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) +static BOOL BitBlt_SRCCOPY_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int y; BYTE* srcp; BYTE* dstp; if (!hdcDest || !hdcSrc) - return 0; + return FALSE; if ((hdcDest->selectedObject != hdcSrc->selectedObject) || - gdi_CopyOverlap(nXDest, nYDest, nWidth, nHeight, nXSrc, nYSrc) == 0) + !gdi_CopyOverlap(nXDest, nYDest, nWidth, nHeight, nXSrc, nYSrc)) { for (y = 0; y < nHeight; y++) { @@ -179,7 +180,7 @@ static int BitBlt_SRCCOPY_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi memmove(dstp, srcp, nWidth * hdcDest->bytesPerPixel); } - return 1; + return TRUE; } if (nYSrc < nYDest) @@ -219,17 +220,17 @@ static int BitBlt_SRCCOPY_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi } } - return 1; + return TRUE; } -static int BitBlt_NOTSRCCOPY_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) +static BOOL BitBlt_NOTSRCCOPY_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; UINT32* srcp; UINT32* dstp; if (!hdcDest || !hdcSrc) - return 0; + return FALSE; for (y = 0; y < nHeight; y++) { @@ -247,10 +248,10 @@ static int BitBlt_NOTSRCCOPY_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int } } - return 1; + return TRUE; } -static int BitBlt_DSTINVERT_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight) +static BOOL BitBlt_DSTINVERT_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight) { int x, y; UINT32* dstp; @@ -269,17 +270,17 @@ static int BitBlt_DSTINVERT_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int n } } - return 1; + return TRUE; } -static int BitBlt_SRCERASE_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) +static BOOL BitBlt_SRCERASE_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; UINT32* srcp; UINT32* dstp; if (!hdcDest || !hdcSrc) - return 0; + return FALSE; for (y = 0; y < nHeight; y++) { @@ -297,17 +298,17 @@ static int BitBlt_SRCERASE_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nW } } - return 1; + return TRUE; } -static int BitBlt_NOTSRCERASE_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) +static BOOL BitBlt_NOTSRCERASE_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; UINT32* srcp; UINT32* dstp; if (!hdcDest || !hdcSrc) - return 0; + return FALSE; for (y = 0; y < nHeight; y++) { @@ -325,17 +326,17 @@ static int BitBlt_NOTSRCERASE_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int } } - return 1; + return TRUE; } -static int BitBlt_SRCINVERT_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) +static BOOL BitBlt_SRCINVERT_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; UINT32* srcp; UINT32* dstp; if (!hdcDest || !hdcSrc) - return 0; + return FALSE; for (y = 0; y < nHeight; y++) { @@ -353,17 +354,17 @@ static int BitBlt_SRCINVERT_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int n } } - return 1; + return TRUE; } -static int BitBlt_SRCAND_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) +static BOOL BitBlt_SRCAND_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; UINT32* srcp; UINT32* dstp; if (!hdcDest || !hdcSrc) - return 0; + return FALSE; for (y = 0; y < nHeight; y++) { @@ -381,17 +382,17 @@ static int BitBlt_SRCAND_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWid } } - return 1; + return TRUE; } -static int BitBlt_SRCPAINT_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) +static BOOL BitBlt_SRCPAINT_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; UINT32* srcp; UINT32* dstp; if (!hdcDest || !hdcSrc) - return 0; + return FALSE; for (y = 0; y < nHeight; y++) { @@ -409,10 +410,10 @@ static int BitBlt_SRCPAINT_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nW } } - return 1; + return TRUE; } -static int BitBlt_DSPDxax_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) +static BOOL BitBlt_DSPDxax_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; UINT32* srcp; @@ -424,7 +425,7 @@ static int BitBlt_DSPDxax_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi HGDI_BITMAP hSrcBmp; if (!hdcDest || !hdcSrc) - return 0; + return FALSE; /* D = (S & P) | (~S & D) */ @@ -477,10 +478,10 @@ static int BitBlt_DSPDxax_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi } } - return 1; + return TRUE; } -static int BitBlt_PSDPxax_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) +static BOOL BitBlt_PSDPxax_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; UINT32* srcp; @@ -489,7 +490,7 @@ static int BitBlt_PSDPxax_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi UINT32 color32; if (!hdcDest || !hdcSrc) - return 0; + return FALSE; /* D = (S & D) | (~S & P) */ @@ -534,10 +535,10 @@ static int BitBlt_PSDPxax_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi } } - return 1; + return TRUE; } -static int BitBlt_SPDSxax_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) +static BOOL BitBlt_SPDSxax_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; UINT32* srcp; @@ -546,7 +547,7 @@ static int BitBlt_SPDSxax_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi UINT32 color32; if (!hdcDest || !hdcSrc) - return 0; + return FALSE; /* D = S ^ (P & (D ^ S)) */ @@ -591,10 +592,10 @@ static int BitBlt_SPDSxax_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi } } - return 1; + return TRUE; } -static int BitBlt_SPna_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) +static BOOL BitBlt_SPna_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; UINT32* srcp; @@ -602,7 +603,7 @@ static int BitBlt_SPna_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth UINT32* patp; if (!hdcDest || !hdcSrc) - return 0; + return FALSE; for (y = 0; y < nHeight; y++) { @@ -622,17 +623,17 @@ static int BitBlt_SPna_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth } } - return 1; + return TRUE; } -static int BitBlt_DSna_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) +static BOOL BitBlt_DSna_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; UINT32* srcp; UINT32* dstp; if (!hdcDest || !hdcSrc) - return 0; + return FALSE; for (y = 0; y < nHeight; y++) { @@ -650,10 +651,10 @@ static int BitBlt_DSna_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth } } - return 1; + return TRUE; } -static int BitBlt_DPa_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight) +static BOOL BitBlt_DPa_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight) { int x, y; UINT32* dstp; @@ -675,10 +676,10 @@ static int BitBlt_DPa_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, } } - return 1; + return TRUE; } -static int BitBlt_PDxn_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight) +static BOOL BitBlt_PDxn_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight) { int x, y; UINT32* dstp; @@ -700,10 +701,10 @@ static int BitBlt_PDxn_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth } } - return 1; + return TRUE; } -static int BitBlt_MERGECOPY_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) +static BOOL BitBlt_MERGECOPY_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; UINT32* srcp; @@ -711,7 +712,7 @@ static int BitBlt_MERGECOPY_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int n UINT32* patp; if (!hdcDest || !hdcSrc) - return 0; + return FALSE; for (y = 0; y < nHeight; y++) { @@ -731,17 +732,17 @@ static int BitBlt_MERGECOPY_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int n } } - return 1; + return TRUE; } -static int BitBlt_MERGEPAINT_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) +static BOOL BitBlt_MERGEPAINT_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; UINT32* srcp; UINT32* dstp; if (!hdcDest || !hdcSrc) - return 0; + return FALSE; for (y = 0; y < nHeight; y++) { @@ -759,10 +760,10 @@ static int BitBlt_MERGEPAINT_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int } } - return 1; + return TRUE; } -static int BitBlt_PATCOPY_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight) +static BOOL BitBlt_PATCOPY_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight) { int x, y, xOffset, yOffset; UINT32* dstp; @@ -818,10 +819,10 @@ static int BitBlt_PATCOPY_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi } } - return 1; + return TRUE; } -static int BitBlt_PATINVERT_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight) +static BOOL BitBlt_PATINVERT_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight) { int x, y; UINT32* dstp; @@ -864,10 +865,10 @@ static int BitBlt_PATINVERT_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int n } } - return 1; + return TRUE; } -static int BitBlt_PATPAINT_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) +static BOOL BitBlt_PATPAINT_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; UINT32* srcp; @@ -875,7 +876,7 @@ static int BitBlt_PATPAINT_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nW UINT32* patp; if (!hdcDest || !hdcSrc) - return 0; + return FALSE; for (y = 0; y < nHeight; y++) { @@ -894,27 +895,27 @@ static int BitBlt_PATPAINT_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nW } } - return 1; + return TRUE; } -int BitBlt_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc, int rop) +BOOL BitBlt_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc, DWORD rop) { if (!hdcDest) - return 0; + return FALSE; if (hdcSrc != NULL) { - if (gdi_ClipCoords(hdcDest, &nXDest, &nYDest, &nWidth, &nHeight, &nXSrc, &nYSrc) == 0) - return 1; + if (!gdi_ClipCoords(hdcDest, &nXDest, &nYDest, &nWidth, &nHeight, &nXSrc, &nYSrc)) + return TRUE; } else { - if (gdi_ClipCoords(hdcDest, &nXDest, &nYDest, &nWidth, &nHeight, NULL, NULL) == 0) - return 1; + if (!gdi_ClipCoords(hdcDest, &nXDest, &nYDest, &nWidth, &nHeight, NULL, NULL)) + return TRUE; } if (!gdi_InvalidateRegion(hdcDest, nXDest, nYDest, nWidth, nHeight)) - return 0; + return FALSE; switch (rop) { @@ -980,16 +981,16 @@ int BitBlt_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeigh } WLog_ERR(TAG, "BitBlt: unknown rop: 0x%08X", rop); - return 1; + return FALSE; } -int PatBlt_32bpp(HGDI_DC hdc, int nXLeft, int nYLeft, int nWidth, int nHeight, int rop) +BOOL PatBlt_32bpp(HGDI_DC hdc, int nXLeft, int nYLeft, int nWidth, int nHeight, DWORD rop) { - if (gdi_ClipCoords(hdc, &nXLeft, &nYLeft, &nWidth, &nHeight, NULL, NULL) == 0) - return 1; + if (!gdi_ClipCoords(hdc, &nXLeft, &nYLeft, &nWidth, &nHeight, NULL, NULL)) + return TRUE; if (!gdi_InvalidateRegion(hdc, nXLeft, nYLeft, nWidth, nHeight)) - return 0; + return FALSE; switch (rop) { @@ -1019,7 +1020,7 @@ int PatBlt_32bpp(HGDI_DC hdc, int nXLeft, int nYLeft, int nWidth, int nHeight, i } WLog_ERR(TAG, "PatBlt: unknown rop: 0x%08X", rop); - return 1; + return FALSE; } static INLINE void SetPixel_BLACK_32bpp(UINT32* pixel, UINT32* pen) @@ -1241,15 +1242,15 @@ pLineTo_32bpp LineTo_ROP2_32bpp[32] = LineTo_WHITE_32bpp }; -int LineTo_32bpp(HGDI_DC hdc, int nXEnd, int nYEnd) +BOOL LineTo_32bpp(HGDI_DC hdc, int nXEnd, int nYEnd) { pLineTo_32bpp _LineTo; int rop2 = gdi_GetROP2(hdc) - 1; _LineTo = LineTo_ROP2_32bpp[rop2]; - if (_LineTo != NULL) - return _LineTo(hdc, nXEnd, nYEnd); - else - return 0; + if (_LineTo == NULL) + return FALSE; + + return _LineTo(hdc, nXEnd, nYEnd); } diff --git a/libfreerdp/gdi/8bpp.c b/libfreerdp/gdi/8bpp.c index 15e88de48..4299d38d3 100644 --- a/libfreerdp/gdi/8bpp.c +++ b/libfreerdp/gdi/8bpp.c @@ -44,16 +44,18 @@ BYTE gdi_get_color_8bpp(HGDI_DC hdc, GDI_COLOR color) { /* TODO: Implement 8bpp gdi_get_color_8bpp() */ + WLog_ERR(TAG, "%s: not implemented", __FUNCTION__); return 1; } -int FillRect_8bpp(HGDI_DC hdc, HGDI_RECT rect, HGDI_BRUSH hbr) +BOOL FillRect_8bpp(HGDI_DC hdc, HGDI_RECT rect, HGDI_BRUSH hbr) { /* TODO: Implement 8bpp FillRect() */ - return 1; + WLog_ERR(TAG, "%s: not implemented", __FUNCTION__); + return TRUE; } -static int BitBlt_BLACKNESS_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight) +static BOOL BitBlt_BLACKNESS_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight) { int y; BYTE* dstp; @@ -66,10 +68,10 @@ static int BitBlt_BLACKNESS_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nW memset(dstp, 0, nWidth * hdcDest->bytesPerPixel); } - return 1; + return TRUE; } -static int BitBlt_WHITENESS_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight) +static BOOL BitBlt_WHITENESS_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight) { int y; BYTE* dstp; @@ -82,20 +84,20 @@ static int BitBlt_WHITENESS_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nW memset(dstp, 0xFF, nWidth * hdcDest->bytesPerPixel); } - return 1; + return TRUE; } -static int BitBlt_SRCCOPY_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) +static BOOL BitBlt_SRCCOPY_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int y; BYTE* srcp; BYTE* dstp; if (!hdcSrc || !hdcDest) - return 0; + return FALSE; if ((hdcDest->selectedObject != hdcSrc->selectedObject) || - gdi_CopyOverlap(nXDest, nYDest, nWidth, nHeight, nXSrc, nYSrc) == 0) + !gdi_CopyOverlap(nXDest, nYDest, nWidth, nHeight, nXSrc, nYSrc)) { for (y = 0; y < nHeight; y++) { @@ -106,7 +108,7 @@ static int BitBlt_SRCCOPY_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWid memcpy(dstp, srcp, nWidth * hdcDest->bytesPerPixel); } - return 1; + return TRUE; } if (nYSrc < nYDest) @@ -146,17 +148,17 @@ static int BitBlt_SRCCOPY_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWid } } - return 1; + return TRUE; } -static int BitBlt_NOTSRCCOPY_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) +static BOOL BitBlt_NOTSRCCOPY_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; BYTE* srcp; BYTE* dstp; if (!hdcSrc || !hdcDest) - return 0; + return FALSE; for (y = 0; y < nHeight; y++) { @@ -174,10 +176,10 @@ static int BitBlt_NOTSRCCOPY_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int n } } - return 1; + return TRUE; } -static int BitBlt_DSTINVERT_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight) +static BOOL BitBlt_DSTINVERT_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight) { int x, y; BYTE* dstp; @@ -196,17 +198,17 @@ static int BitBlt_DSTINVERT_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nW } } - return 1; + return TRUE; } -static int BitBlt_SRCERASE_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) +static BOOL BitBlt_SRCERASE_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; BYTE* srcp; BYTE* dstp; if (!hdcSrc || !hdcDest) - return 0; + return FALSE; for (y = 0; y < nHeight; y++) { @@ -224,17 +226,17 @@ static int BitBlt_SRCERASE_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi } } - return 1; + return TRUE; } -static int BitBlt_NOTSRCERASE_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) +static BOOL BitBlt_NOTSRCERASE_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; BYTE* srcp; BYTE* dstp; if (!hdcSrc || !hdcDest) - return 0; + return FALSE; for (y = 0; y < nHeight; y++) { @@ -252,17 +254,17 @@ static int BitBlt_NOTSRCERASE_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int } } - return 1; + return TRUE; } -static int BitBlt_SRCINVERT_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) +static BOOL BitBlt_SRCINVERT_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; BYTE* srcp; BYTE* dstp; if (!hdcSrc || !hdcDest) - return 0; + return FALSE; for (y = 0; y < nHeight; y++) { @@ -280,17 +282,17 @@ static int BitBlt_SRCINVERT_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nW } } - return 1; + return TRUE; } -static int BitBlt_SRCAND_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) +static BOOL BitBlt_SRCAND_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; BYTE* srcp; BYTE* dstp; if (!hdcSrc || !hdcDest) - return 0; + return FALSE; for (y = 0; y < nHeight; y++) { @@ -308,17 +310,17 @@ static int BitBlt_SRCAND_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidt } } - return 1; + return TRUE; } -static int BitBlt_SRCPAINT_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) +static BOOL BitBlt_SRCPAINT_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; BYTE* srcp; BYTE* dstp; if (!hdcSrc || !hdcDest) - return 0; + return FALSE; for (y = 0; y < nHeight; y++) { @@ -336,19 +338,20 @@ static int BitBlt_SRCPAINT_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi } } - return 1; + return TRUE; } -static int BitBlt_DSPDxax_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) +static BOOL BitBlt_DSPDxax_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { if (!hdcSrc || !hdcDest) - return 0; + return FALSE; /* TODO: Implement 8bpp DSPDxax BitBlt */ - return 1; + WLog_ERR(TAG, "%s: not implemented", __FUNCTION__); + return TRUE; } -static int BitBlt_PSDPxax_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) +static BOOL BitBlt_PSDPxax_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; BYTE* srcp; @@ -357,7 +360,7 @@ static int BitBlt_PSDPxax_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWid BYTE color8; if (!hdcSrc || !hdcDest) - return 0; + return FALSE; /* D = (S & D) | (~S & P) */ @@ -402,10 +405,10 @@ static int BitBlt_PSDPxax_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWid } } - return 1; + return TRUE; } -static int BitBlt_SPna_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) +static BOOL BitBlt_SPna_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; BYTE* srcp; @@ -413,7 +416,7 @@ static int BitBlt_SPna_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, BYTE* patp; if (!hdcSrc || !hdcDest) - return 0; + return FALSE; for (y = 0; y < nHeight; y++) { @@ -434,10 +437,10 @@ static int BitBlt_SPna_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, } } - return 1; + return TRUE; } -static int BitBlt_DPa_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight) +static BOOL BitBlt_DPa_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight) { int x, y; BYTE* dstp; @@ -459,10 +462,10 @@ static int BitBlt_DPa_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, } } - return 1; + return TRUE; } -static int BitBlt_PDxn_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight) +static BOOL BitBlt_PDxn_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight) { int x, y; BYTE* dstp; @@ -485,17 +488,17 @@ static int BitBlt_PDxn_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, } } - return 1; + return TRUE; } -static int BitBlt_DSna_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) +static BOOL BitBlt_DSna_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; BYTE* srcp; BYTE* dstp; if (!hdcSrc || !hdcDest) - return 0; + return FALSE; for (y = 0; y < nHeight; y++) { @@ -513,10 +516,10 @@ static int BitBlt_DSna_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, } } - return 1; + return TRUE; } -static int BitBlt_MERGECOPY_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) +static BOOL BitBlt_MERGECOPY_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; BYTE* srcp; @@ -524,7 +527,7 @@ static int BitBlt_MERGECOPY_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nW BYTE* patp; if (!hdcSrc || !hdcDest) - return 0; + return FALSE; for (y = 0; y < nHeight; y++) { @@ -545,17 +548,17 @@ static int BitBlt_MERGECOPY_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nW } } - return 1; + return TRUE; } -static int BitBlt_MERGEPAINT_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) +static BOOL BitBlt_MERGEPAINT_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; BYTE* srcp; BYTE* dstp; if (!hdcSrc || !hdcDest) - return 0; + return FALSE; for (y = 0; y < nHeight; y++) { @@ -573,10 +576,10 @@ static int BitBlt_MERGEPAINT_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int n } } - return 1; + return TRUE; } -static int BitBlt_PATCOPY_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight) +static BOOL BitBlt_PATCOPY_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight) { int x, y, xOffset, yOffset; BYTE* dstp; @@ -632,10 +635,10 @@ static int BitBlt_PATCOPY_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWid } } - return 1; + return TRUE; } -static int BitBlt_PATINVERT_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight) +static BOOL BitBlt_PATINVERT_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight) { int x, y; BYTE* dstp; @@ -678,10 +681,10 @@ static int BitBlt_PATINVERT_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nW } } - return 1; + return TRUE; } -static int BitBlt_PATPAINT_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) +static BOOL BitBlt_PATPAINT_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; BYTE* srcp; @@ -689,7 +692,7 @@ static int BitBlt_PATPAINT_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi BYTE* patp; if (!hdcSrc || !hdcDest) - return 0; + return FALSE; for (y = 0; y < nHeight; y++) { @@ -710,27 +713,27 @@ static int BitBlt_PATPAINT_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi } } - return 1; + return TRUE; } -int BitBlt_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc, int rop) +BOOL BitBlt_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc, DWORD rop) { if (!hdcDest) - return 0; + return FALSE; if (hdcSrc != NULL) { - if (gdi_ClipCoords(hdcDest, &nXDest, &nYDest, &nWidth, &nHeight, &nXSrc, &nYSrc) == 0) - return 1; + if (!gdi_ClipCoords(hdcDest, &nXDest, &nYDest, &nWidth, &nHeight, &nXSrc, &nYSrc)) + return TRUE; } else { - if (gdi_ClipCoords(hdcDest, &nXDest, &nYDest, &nWidth, &nHeight, NULL, NULL) == 0) - return 1; + if (!gdi_ClipCoords(hdcDest, &nXDest, &nYDest, &nWidth, &nHeight, NULL, NULL)) + return TRUE; } if (!gdi_InvalidateRegion(hdcDest, nXDest, nYDest, nWidth, nHeight)) - return 0; + return FALSE; switch (rop) { @@ -793,16 +796,16 @@ int BitBlt_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight } WLog_ERR(TAG, "BitBlt: unknown rop: 0x%08X", rop); - return 1; + return FALSE; } -int PatBlt_8bpp(HGDI_DC hdc, int nXLeft, int nYLeft, int nWidth, int nHeight, int rop) +BOOL PatBlt_8bpp(HGDI_DC hdc, int nXLeft, int nYLeft, int nWidth, int nHeight, DWORD rop) { - if (gdi_ClipCoords(hdc, &nXLeft, &nYLeft, &nWidth, &nHeight, NULL, NULL) == 0) - return 1; + if (!gdi_ClipCoords(hdc, &nXLeft, &nYLeft, &nWidth, &nHeight, NULL, NULL)) + return TRUE; if (!gdi_InvalidateRegion(hdc, nXLeft, nYLeft, nWidth, nHeight)) - return 0; + return FALSE; switch (rop) { @@ -1054,15 +1057,15 @@ pLineTo_8bpp LineTo_ROP2_8bpp[32] = LineTo_WHITE_8bpp }; -int LineTo_8bpp(HGDI_DC hdc, int nXEnd, int nYEnd) +BOOL LineTo_8bpp(HGDI_DC hdc, int nXEnd, int nYEnd) { pLineTo_8bpp _LineTo; int rop2 = gdi_GetROP2(hdc) - 1; _LineTo = LineTo_ROP2_8bpp[rop2]; - if (_LineTo != NULL) - return _LineTo(hdc, nXEnd, nYEnd); - else - return 0; + if (_LineTo == NULL) + return FALSE; + + return _LineTo(hdc, nXEnd, nYEnd); } diff --git a/libfreerdp/gdi/bitmap.c b/libfreerdp/gdi/bitmap.c index da150ec24..cc3ee84ed 100644 --- a/libfreerdp/gdi/bitmap.c +++ b/libfreerdp/gdi/bitmap.c @@ -198,12 +198,12 @@ HGDI_BITMAP gdi_CreateCompatibleBitmap(HGDI_DC hdc, int nWidth, int nHeight) * @return 0 on failure, non-zero otherwise */ -int gdi_BitBlt(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc, int rop) +BOOL gdi_BitBlt(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc, DWORD rop) { p_BitBlt _BitBlt = BitBlt_[IBPP(hdcDest->bitsPerPixel)]; - if (_BitBlt != NULL) - return _BitBlt(hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc, rop); - else - return 0; + if (_BitBlt == NULL) + return FALSE; + + return _BitBlt(hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc, rop); } diff --git a/libfreerdp/gdi/brush.c b/libfreerdp/gdi/brush.c index 2e62138d6..0fadb9768 100644 --- a/libfreerdp/gdi/brush.c +++ b/libfreerdp/gdi/brush.c @@ -100,15 +100,15 @@ HGDI_BRUSH gdi_CreateHatchBrush(HGDI_BITMAP hbmp) * @param nWidth width * @param nHeight height * @param rop raster operation code - * @return 1 if successful, 0 otherwise + * @return nonzero if successful, 0 otherwise */ -int gdi_PatBlt(HGDI_DC hdc, int nXLeft, int nYLeft, int nWidth, int nHeight, int rop) +BOOL gdi_PatBlt(HGDI_DC hdc, int nXLeft, int nYLeft, int nWidth, int nHeight, DWORD rop) { p_PatBlt _PatBlt = PatBlt_[IBPP(hdc->bitsPerPixel)]; - if (_PatBlt != NULL) - return _PatBlt(hdc, nXLeft, nYLeft, nWidth, nHeight, rop); - else - return 0; + if (_PatBlt == NULL) + return FALSE; + + return _PatBlt(hdc, nXLeft, nYLeft, nWidth, nHeight, rop); } diff --git a/libfreerdp/gdi/clipping.c b/libfreerdp/gdi/clipping.c index e6186a14f..74b259820 100644 --- a/libfreerdp/gdi/clipping.c +++ b/libfreerdp/gdi/clipping.c @@ -32,7 +32,7 @@ #include -int gdi_SetClipRgn(HGDI_DC hdc, int nXLeft, int nYLeft, int nWidth, int nHeight) +BOOL gdi_SetClipRgn(HGDI_DC hdc, int nXLeft, int nYLeft, int nWidth, int nHeight) { return gdi_SetRgn(hdc->clip, nXLeft, nYLeft, nWidth, nHeight); } @@ -52,14 +52,14 @@ HGDI_RGN gdi_GetClipRgn(HGDI_DC hdc) /** * Set the current clipping region to null. * @param hdc device context - * @return + * @return nonzero on success, 0 otherwise */ -int gdi_SetNullClipRgn(HGDI_DC hdc) +BOOL gdi_SetNullClipRgn(HGDI_DC hdc) { gdi_SetClipRgn(hdc, 0, 0, 0, 0); hdc->clip->null = 1; - return 0; + return TRUE; } /** @@ -71,10 +71,10 @@ int gdi_SetNullClipRgn(HGDI_DC hdc) * @param h height * @param srcx source x1 * @param srcy source y1 - * @return 1 if there is something to draw, 0 otherwise + * @return nonzero if there is something to draw, 0 otherwise */ -int gdi_ClipCoords(HGDI_DC hdc, int *x, int *y, int *w, int *h, int *srcx, int *srcy) +BOOL gdi_ClipCoords(HGDI_DC hdc, int *x, int *y, int *w, int *h, int *srcx, int *srcy) { GDI_RECT bmp; GDI_RECT clip; @@ -83,10 +83,10 @@ int gdi_ClipCoords(HGDI_DC hdc, int *x, int *y, int *w, int *h, int *srcx, int * int dx = 0; int dy = 0; - int draw = 1; + BOOL draw = TRUE; if (hdc == NULL) - return 0; + return FALSE; hBmp = (HGDI_BITMAP) hdc->selectedObject; @@ -152,7 +152,7 @@ int gdi_ClipCoords(HGDI_DC hdc, int *x, int *y, int *w, int *h, int *srcx, int * coords.right = 0; coords.top = 0; coords.bottom = 0; - draw = 0; + draw = FALSE; } if (srcx != NULL) diff --git a/libfreerdp/gdi/dc.c b/libfreerdp/gdi/dc.c index f5fbb8c50..b816a77b5 100644 --- a/libfreerdp/gdi/dc.c +++ b/libfreerdp/gdi/dc.c @@ -189,13 +189,13 @@ HGDIOBJECT gdi_SelectObject(HGDI_DC hdc, HGDIOBJECT hgdiobject) * Delete a GDI object.\n * @msdn{dd183539} * @param hgdiobject GDI object - * @return 1 if successful, 0 otherwise + * @return nonzero if successful, 0 otherwise */ -int gdi_DeleteObject(HGDIOBJECT hgdiobject) +BOOL gdi_DeleteObject(HGDIOBJECT hgdiobject) { if (!hgdiobject) - return 0; + return FALSE; if (hgdiobject->objectType == GDIOBJECT_BITMAP) { @@ -235,20 +235,20 @@ int gdi_DeleteObject(HGDIOBJECT hgdiobject) { /* Unknown GDI Object Type */ free(hgdiobject); - return 0; + return FALSE; } - return 1; + return TRUE; } /** * Delete device context.\n * @msdn{dd183533} * @param hdc device context - * @return 1 if successful, 0 otherwise + * @return nonzero if successful, 0 otherwise */ -int gdi_DeleteDC(HGDI_DC hdc) +BOOL gdi_DeleteDC(HGDI_DC hdc) { if (hdc) { @@ -262,5 +262,5 @@ int gdi_DeleteDC(HGDI_DC hdc) free(hdc); } - return 1; + return TRUE; } diff --git a/libfreerdp/gdi/drawing.c b/libfreerdp/gdi/drawing.c index 9b81d657d..1e1475dc7 100644 --- a/libfreerdp/gdi/drawing.c +++ b/libfreerdp/gdi/drawing.c @@ -107,16 +107,17 @@ int gdi_GetBkMode(HGDI_DC hdc) * @msdn{dd162965} * @param hdc device context * @param iBkMode background mode - * @return + * @return previous background mode on success, 0 on failure */ int gdi_SetBkMode(HGDI_DC hdc, int iBkMode) { if (iBkMode == GDI_OPAQUE || iBkMode == GDI_TRANSPARENT) + { + int previousBkMode = hdc->bkMode; hdc->bkMode = iBkMode; - else - hdc->bkMode = GDI_OPAQUE; - + return previousBkMode; + } return 0; } diff --git a/libfreerdp/gdi/gdi.c b/libfreerdp/gdi/gdi.c index fd17e8500..271ecd7ef 100644 --- a/libfreerdp/gdi/gdi.c +++ b/libfreerdp/gdi/gdi.c @@ -45,7 +45,7 @@ #define TAG FREERDP_TAG("gdi") /* Ternary Raster Operation Table */ -static const UINT32 rop3_code_table[] = +static const DWORD rop3_code_table[] = { 0x00000042, /* 0 */ 0x00010289, /* DPSoon */ @@ -318,7 +318,7 @@ static BYTE GDI_BS_HATCHED_PATTERNS[] = /* GDI Helper Functions */ -INLINE UINT32 gdi_rop3_code(BYTE code) +INLINE DWORD gdi_rop3_code(BYTE code) { return rop3_code_table[code]; } @@ -585,10 +585,9 @@ static BOOL gdi_dstblt(rdpContext* context, DSTBLT_ORDER* dstblt) { rdpGdi* gdi = context->gdi; - if (gdi_BitBlt(gdi->drawing->hdc, dstblt->nLeftRect, dstblt->nTopRect, - dstblt->nWidth, dstblt->nHeight, NULL, 0, 0, gdi_rop3_code(dstblt->bRop)) == 0) - return FALSE; - return TRUE; + return gdi_BitBlt(gdi->drawing->hdc, dstblt->nLeftRect, dstblt->nTopRect, + dstblt->nWidth, dstblt->nHeight, NULL, 0, 0, + gdi_rop3_code(dstblt->bRop)); } static BOOL gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt) @@ -620,9 +619,11 @@ static BOOL gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt) goto out_error; } - if (gdi_PatBlt(gdi->drawing->hdc, patblt->nLeftRect, patblt->nTopRect, - patblt->nWidth, patblt->nHeight, gdi_rop3_code(patblt->bRop)) == 0) + if (!gdi_PatBlt(gdi->drawing->hdc, patblt->nLeftRect, patblt->nTopRect, + patblt->nWidth, patblt->nHeight, gdi_rop3_code(patblt->bRop))) + { ret = FALSE; + } gdi_DeleteObject((HGDIOBJECT) gdi->drawing->hdc->brush); gdi->drawing->hdc->brush = originalBrush; @@ -661,9 +662,11 @@ static BOOL gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt) goto out_error; } - if (gdi_PatBlt(gdi->drawing->hdc, patblt->nLeftRect, patblt->nTopRect, - patblt->nWidth, patblt->nHeight, gdi_rop3_code(patblt->bRop)) == 0) + if (!gdi_PatBlt(gdi->drawing->hdc, patblt->nLeftRect, patblt->nTopRect, + patblt->nWidth, patblt->nHeight, gdi_rop3_code(patblt->bRop))) + { ret = FALSE; + } gdi_DeleteObject((HGDIOBJECT) gdi->drawing->hdc->brush); gdi->drawing->hdc->brush = originalBrush; @@ -717,9 +720,11 @@ static BOOL gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt) goto out_error; } - if (gdi_PatBlt(gdi->drawing->hdc, patblt->nLeftRect, patblt->nTopRect, - patblt->nWidth, patblt->nHeight, gdi_rop3_code(patblt->bRop)) == 0) + if (!gdi_PatBlt(gdi->drawing->hdc, patblt->nLeftRect, patblt->nTopRect, + patblt->nWidth, patblt->nHeight, gdi_rop3_code(patblt->bRop))) + { ret = FALSE; + } gdi_DeleteObject((HGDIOBJECT) gdi->drawing->hdc->brush); gdi->drawing->hdc->brush = originalBrush; @@ -738,11 +743,9 @@ static BOOL gdi_scrblt(rdpContext* context, SCRBLT_ORDER* scrblt) { rdpGdi* gdi = context->gdi; - if (gdi_BitBlt(gdi->drawing->hdc, scrblt->nLeftRect, scrblt->nTopRect, + return gdi_BitBlt(gdi->drawing->hdc, scrblt->nLeftRect, scrblt->nTopRect, scrblt->nWidth, scrblt->nHeight, gdi->primary->hdc, - scrblt->nXSrc, scrblt->nYSrc, gdi_rop3_code(scrblt->bRop)) == 0) - return FALSE; - return TRUE; + scrblt->nXSrc, scrblt->nYSrc, gdi_rop3_code(scrblt->bRop)); } static BOOL gdi_opaque_rect(rdpContext* context, OPAQUE_RECT_ORDER* opaque_rect) @@ -751,20 +754,19 @@ static BOOL gdi_opaque_rect(rdpContext* context, OPAQUE_RECT_ORDER* opaque_rect) HGDI_BRUSH hBrush; UINT32 brush_color; rdpGdi* gdi = context->gdi; - BOOL ret = FALSE; + BOOL ret; gdi_CRgnToRect(opaque_rect->nLeftRect, opaque_rect->nTopRect, opaque_rect->nWidth, opaque_rect->nHeight, &rect); brush_color = freerdp_convert_gdi_order_color(opaque_rect->color, gdi->srcBpp, gdi->format, gdi->palette); - hBrush = gdi_CreateSolidBrush(brush_color); - if (hBrush) - { - if (gdi_FillRect(gdi->drawing->hdc, &rect, hBrush) == 0) - ret = TRUE; - gdi_DeleteObject((HGDIOBJECT) hBrush); - } + if (!(hBrush = gdi_CreateSolidBrush(brush_color))) + return FALSE; + + ret = gdi_FillRect(gdi->drawing->hdc, &rect, hBrush); + gdi_DeleteObject((HGDIOBJECT) hBrush); + return ret; } @@ -807,9 +809,9 @@ static BOOL gdi_line_to(rdpContext* context, LINE_TO_ORDER* lineTo) rdpGdi* gdi = context->gdi; color = freerdp_convert_gdi_order_color(lineTo->penColor, gdi->srcBpp, gdi->format, gdi->palette); - hPen = gdi_CreatePen(lineTo->penStyle, lineTo->penWidth, (GDI_COLOR) color); - if (!hPen) + if (!(hPen = gdi_CreatePen(lineTo->penStyle, lineTo->penWidth, (GDI_COLOR) color))) return FALSE; + gdi_SelectObject(gdi->drawing->hdc, (HGDIOBJECT) hPen); gdi_SetROP2(gdi->drawing->hdc, lineTo->bRop2); @@ -831,9 +833,9 @@ static BOOL gdi_polyline(rdpContext* context, POLYLINE_ORDER* polyline) rdpGdi* gdi = context->gdi; color = freerdp_convert_gdi_order_color(polyline->penColor, gdi->srcBpp, gdi->format, gdi->palette); - hPen = gdi_CreatePen(GDI_PS_SOLID, 1, (GDI_COLOR) color); - if (!hPen) + if (!(hPen = gdi_CreatePen(GDI_PS_SOLID, 1, (GDI_COLOR) color))) return FALSE; + gdi_SelectObject(gdi->drawing->hdc, (HGDIOBJECT) hPen); gdi_SetROP2(gdi->drawing->hdc, polyline->bRop2); @@ -861,11 +863,9 @@ static BOOL gdi_memblt(rdpContext* context, MEMBLT_ORDER* memblt) bitmap = (gdiBitmap*) memblt->bitmap; - if (gdi_BitBlt(gdi->drawing->hdc, memblt->nLeftRect, memblt->nTopRect, + return gdi_BitBlt(gdi->drawing->hdc, memblt->nLeftRect, memblt->nTopRect, memblt->nWidth, memblt->nHeight, bitmap->hdc, - memblt->nXSrc, memblt->nYSrc, gdi_rop3_code(memblt->bRop)) == 0) - return FALSE; - return TRUE; + memblt->nXSrc, memblt->nYSrc, gdi_rop3_code(memblt->bRop)); } static BOOL gdi_mem3blt(rdpContext* context, MEM3BLT_ORDER* mem3blt) @@ -972,25 +972,25 @@ out_fail: static BOOL gdi_polygon_sc(rdpContext* context, POLYGON_SC_ORDER* polygon_sc) { - WLog_VRB(TAG, "not implemented"); + WLog_VRB(TAG, "%s: not implemented", __FUNCTION__); return TRUE; } static BOOL gdi_polygon_cb(rdpContext* context, POLYGON_CB_ORDER* polygon_cb) { - WLog_VRB(TAG, "not implemented"); + WLog_VRB(TAG, "%s: not implemented", __FUNCTION__); return TRUE; } static BOOL gdi_ellipse_sc(rdpContext* context, ELLIPSE_SC_ORDER* ellipse_sc) { - WLog_VRB(TAG, "not implemented"); + WLog_VRB(TAG, "%s: not implemented", __FUNCTION__); return TRUE; } static BOOL gdi_ellipse_cb(rdpContext* context, ELLIPSE_CB_ORDER* ellipse_cb) { - WLog_VRB(TAG, "not implemented"); + WLog_VRB(TAG, "%s: not implemented", __FUNCTION__); return TRUE; } diff --git a/libfreerdp/gdi/graphics.c b/libfreerdp/gdi/graphics.c index 4ca13748c..8e53c5280 100644 --- a/libfreerdp/gdi/graphics.c +++ b/libfreerdp/gdi/graphics.c @@ -143,10 +143,8 @@ BOOL gdi_Bitmap_Paint(rdpContext* context, rdpBitmap* bitmap) width = bitmap->right - bitmap->left + 1; height = bitmap->bottom - bitmap->top + 1; - if (gdi_BitBlt(context->gdi->primary->hdc, bitmap->left, bitmap->top, - width, height, gdi_bitmap->hdc, 0, 0, GDI_SRCCOPY) == 0) - return FALSE; - return TRUE; + return gdi_BitBlt(context->gdi->primary->hdc, bitmap->left, bitmap->top, + width, height, gdi_bitmap->hdc, 0, 0, GDI_SRCCOPY); } BOOL gdi_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap, @@ -279,10 +277,8 @@ BOOL gdi_Glyph_Draw(rdpContext* context, rdpGlyph* glyph, int x, int y) gdi_glyph = (gdiGlyph*) glyph; - if (gdi_BitBlt(gdi->drawing->hdc, x, y, gdi_glyph->bitmap->width, - gdi_glyph->bitmap->height, gdi_glyph->hdc, 0, 0, GDI_DSPDxax) == 0) - return FALSE; - return TRUE; + return gdi_BitBlt(gdi->drawing->hdc, x, y, gdi_glyph->bitmap->width, + gdi_glyph->bitmap->height, gdi_glyph->hdc, 0, 0, GDI_DSPDxax); } BOOL gdi_Glyph_BeginDraw(rdpContext* context, int x, int y, int width, int height, UINT32 bgcolor, UINT32 fgcolor, BOOL fOpRedundant) @@ -290,27 +286,23 @@ BOOL gdi_Glyph_BeginDraw(rdpContext* context, int x, int y, int width, int heigh GDI_RECT rect; HGDI_BRUSH brush; rdpGdi* gdi = context->gdi; - int ret = 0; + BOOL ret = FALSE; /* TODO: handle fOpRedundant! See xf_Glyph_BeginDraw() */ bgcolor = freerdp_convert_gdi_order_color(bgcolor, gdi->srcBpp, gdi->format, gdi->palette); fgcolor = freerdp_convert_gdi_order_color(fgcolor, gdi->srcBpp, gdi->format, gdi->palette); - brush = gdi_CreateSolidBrush(fgcolor); - if (!brush) - goto out_fail; + if (!(brush = gdi_CreateSolidBrush(fgcolor))) + goto out; gdi_CRgnToRect(x, y, width, height, &rect); ret = gdi_FillRect(gdi->drawing->hdc, &rect, brush); gdi_DeleteObject((HGDIOBJECT) brush); -out_fail: +out: gdi->textColor = gdi_SetTextColor(gdi->drawing->hdc, bgcolor); - - if (ret == 0) - return FALSE; - return TRUE; + return ret; } BOOL gdi_Glyph_EndDraw(rdpContext* context, int x, int y, int width, int height, UINT32 bgcolor, UINT32 fgcolor) diff --git a/libfreerdp/gdi/include/line.c b/libfreerdp/gdi/include/line.c index fb48c2552..2df68c1c6 100644 --- a/libfreerdp/gdi/include/line.c +++ b/libfreerdp/gdi/include/line.c @@ -19,7 +19,7 @@ /* do not include this file directly! */ -int LINE_TO(HGDI_DC hdc, int nXEnd, int nYEnd) +BOOL LINE_TO(HGDI_DC hdc, int nXEnd, int nYEnd) { int x, y; int x1, y1; @@ -72,7 +72,7 @@ int LINE_TO(HGDI_DC hdc, int nXEnd, int nYEnd) by2 = MIN(by2, bmp->height - 1); if (!gdi_InvalidateRegion(hdc, bx1, by1, bx2 - bx1 + 1, by2 - by1 + 1)) - return 0; + return FALSE; pen = GDI_GET_PEN_COLOR(hdc->pen); @@ -106,7 +106,7 @@ int LINE_TO(HGDI_DC hdc, int nXEnd, int nYEnd) } } - return 1; + return TRUE; } /* diff --git a/libfreerdp/gdi/line.c b/libfreerdp/gdi/line.c index aef8b9e9b..9d1b4248a 100644 --- a/libfreerdp/gdi/line.c +++ b/libfreerdp/gdi/line.c @@ -49,17 +49,17 @@ p_LineTo LineTo_[5] = * @param hdc device context * @param nXEnd ending x position * @param nYEnd ending y position - * @return 1 if successful, 0 otherwise + * @return nonzero if successful, 0 otherwise */ -int gdi_LineTo(HGDI_DC hdc, int nXEnd, int nYEnd) +BOOL gdi_LineTo(HGDI_DC hdc, int nXEnd, int nYEnd) { p_LineTo _LineTo = LineTo_[IBPP(hdc->bitsPerPixel)]; - if (_LineTo != NULL) - return _LineTo(hdc, nXEnd, nYEnd); - else - return 0; + if (_LineTo == NULL) + return FALSE; + + return _LineTo(hdc, nXEnd, nYEnd); } /** @@ -67,19 +67,21 @@ int gdi_LineTo(HGDI_DC hdc, int nXEnd, int nYEnd) * @param hdc device context * @param lppt array of points * @param cCount number of points - * @return + * @return nonzero on success, 0 otherwise */ -int gdi_PolylineTo(HGDI_DC hdc, GDI_POINT *lppt, int cCount) +BOOL gdi_PolylineTo(HGDI_DC hdc, GDI_POINT *lppt, DWORD cCount) { - int i; + DWORD i; for (i = 0; i < cCount; i++) { - gdi_LineTo(hdc, lppt[i].x, lppt[i].y); - gdi_MoveToEx(hdc, lppt[i].x, lppt[i].y, NULL); + if (!gdi_LineTo(hdc, lppt[i].x, lppt[i].y)) + return FALSE; + if (!gdi_MoveToEx(hdc, lppt[i].x, lppt[i].y, NULL)) + return FALSE; } - return 1; + return TRUE; } /** @@ -87,27 +89,31 @@ int gdi_PolylineTo(HGDI_DC hdc, GDI_POINT *lppt, int cCount) * @param hdc device context * @param lppt array of points * @param cPoints number of points - * @return + * @return nonzero on success, 0 otherwise */ -int gdi_Polyline(HGDI_DC hdc, GDI_POINT *lppt, int cPoints) +BOOL gdi_Polyline(HGDI_DC hdc, GDI_POINT *lppt, int cPoints) { if (cPoints > 0) { int i; GDI_POINT pt; - gdi_MoveToEx(hdc, lppt[0].x, lppt[0].y, &pt); + if (!gdi_MoveToEx(hdc, lppt[0].x, lppt[0].y, &pt)) + return FALSE; for (i = 0; i < cPoints; i++) { - gdi_LineTo(hdc, lppt[i].x, lppt[i].y); - gdi_MoveToEx(hdc, lppt[i].x, lppt[i].y, NULL); + if (!gdi_LineTo(hdc, lppt[i].x, lppt[i].y)) + return FALSE; + if (!gdi_MoveToEx(hdc, lppt[i].x, lppt[i].y, NULL)) + return FALSE; } - gdi_MoveToEx(hdc, pt.x, pt.y, NULL); + if (!gdi_MoveToEx(hdc, pt.x, pt.y, NULL)) + return FALSE; } - return 1; + return TRUE; } /** @@ -116,21 +122,22 @@ int gdi_Polyline(HGDI_DC hdc, GDI_POINT *lppt, int cPoints) * @param lppt array of points * @param lpdwPolyPoints array of numbers of points per series * @param cCount count of entries in lpdwPolyPoints - * @return + * @return nonzero on success, 0 otherwise */ -int gdi_PolyPolyline(HGDI_DC hdc, GDI_POINT *lppt, int *lpdwPolyPoints, int cCount) +BOOL gdi_PolyPolyline(HGDI_DC hdc, GDI_POINT *lppt, int *lpdwPolyPoints, DWORD cCount) { int cPoints; - int i, j = 0; + DWORD i, j = 0; for (i = 0; i < cCount; i++) { cPoints = lpdwPolyPoints[i]; - gdi_Polyline(hdc, &lppt[j], cPoints); + if (!gdi_Polyline(hdc, &lppt[j], cPoints)) + return FALSE; j += cPoints; } - return 1; + return TRUE; } /** @@ -138,10 +145,10 @@ int gdi_PolyPolyline(HGDI_DC hdc, GDI_POINT *lppt, int *lpdwPolyPoints, int cCou * @param hdc device context * @param X x position * @param Y y position - * @return 1 if successful, 0 otherwise + * @return nonzero on success, 0 otherwise */ -int gdi_MoveToEx(HGDI_DC hdc, int X, int Y, HGDI_POINT lpPoint) +BOOL gdi_MoveToEx(HGDI_DC hdc, int X, int Y, HGDI_POINT lpPoint) { if (lpPoint != NULL) { @@ -152,5 +159,5 @@ int gdi_MoveToEx(HGDI_DC hdc, int X, int Y, HGDI_POINT lpPoint) hdc->pen->posX = X; hdc->pen->posY = Y; - return 1; + return TRUE; } diff --git a/libfreerdp/gdi/region.c b/libfreerdp/gdi/region.c index d5d261cba..888a8483f 100644 --- a/libfreerdp/gdi/region.c +++ b/libfreerdp/gdi/region.c @@ -223,10 +223,10 @@ INLINE void gdi_CRgnToCRect(int x, int y, int w, int h, int *left, int *top, int * @param height height * @param srcx source x1 * @param srcy source y1 - * @return 1 if there is an overlap, 0 otherwise + * @return nonzero if there is an overlap, 0 otherwise */ -INLINE int gdi_CopyOverlap(int x, int y, int width, int height, int srcx, int srcy) +INLINE BOOL gdi_CopyOverlap(int x, int y, int width, int height, int srcx, int srcy) { GDI_RECT dst; GDI_RECT src; @@ -235,7 +235,7 @@ INLINE int gdi_CopyOverlap(int x, int y, int width, int height, int srcx, int sr gdi_CRgnToRect(srcx, srcy, width, height, &src); return (dst.right > src.left && dst.left < src.right && - dst.bottom > src.top && dst.top < src.bottom) ? 1 : 0; + dst.bottom > src.top && dst.top < src.bottom) ? TRUE : FALSE; } /** @@ -246,16 +246,16 @@ INLINE int gdi_CopyOverlap(int x, int y, int width, int height, int srcx, int sr * @param yTop y1 * @param xRight x2 * @param yBottom y2 - * @return 1 if successful, 0 otherwise + * @return nonzero if successful, 0 otherwise */ -INLINE int gdi_SetRect(HGDI_RECT rc, int xLeft, int yTop, int xRight, int yBottom) +INLINE BOOL gdi_SetRect(HGDI_RECT rc, int xLeft, int yTop, int xRight, int yBottom) { rc->left = xLeft; rc->top = yTop; rc->right = xRight; rc->bottom = yBottom; - return 1; + return TRUE; } /** @@ -265,17 +265,17 @@ INLINE int gdi_SetRect(HGDI_RECT rc, int xLeft, int yTop, int xRight, int yBotto * @param nYLeft y1 * @param nWidth width * @param nHeight height - * @return + * @return nonzero if successful, 0 otherwise */ -INLINE int gdi_SetRgn(HGDI_RGN hRgn, int nXLeft, int nYLeft, int nWidth, int nHeight) +INLINE BOOL gdi_SetRgn(HGDI_RGN hRgn, int nXLeft, int nYLeft, int nWidth, int nHeight) { hRgn->x = nXLeft; hRgn->y = nYLeft; hRgn->w = nWidth; hRgn->h = nHeight; hRgn->null = 0; - return 0; + return TRUE; } /** @@ -285,14 +285,14 @@ INLINE int gdi_SetRgn(HGDI_RGN hRgn, int nXLeft, int nYLeft, int nWidth, int nHe * @param nTopRect y1 * @param nRightRect x2 * @param nBottomRect y2 - * @return + * @return nonzero if successful, 0 otherwise */ -INLINE int gdi_SetRectRgn(HGDI_RGN hRgn, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect) +INLINE BOOL gdi_SetRectRgn(HGDI_RGN hRgn, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect) { gdi_CRectToRgn(nLeftRect, nTopRect, nRightRect, nBottomRect, hRgn); hRgn->null = 0; - return 0; + return TRUE; } /** @@ -300,36 +300,37 @@ INLINE int gdi_SetRectRgn(HGDI_RGN hRgn, int nLeftRect, int nTopRect, int nRight * @msdn{dd162700} * @param hSrcRgn1 first region * @param hSrcRgn2 second region - * @return 1 if both regions are equal, 0 otherwise + * @return nonzero if both regions are equal, 0 otherwise */ -INLINE int gdi_EqualRgn(HGDI_RGN hSrcRgn1, HGDI_RGN hSrcRgn2) +INLINE BOOL gdi_EqualRgn(HGDI_RGN hSrcRgn1, HGDI_RGN hSrcRgn2) { if ((hSrcRgn1->x == hSrcRgn2->x) && (hSrcRgn1->y == hSrcRgn2->y) && (hSrcRgn1->w == hSrcRgn2->w) && (hSrcRgn1->h == hSrcRgn2->h)) { - return 1; + return TRUE; } - return 0; + return FALSE; } /** * Copy coordinates from a rectangle to another rectangle + * @msdn{dd183481} * @param dst destination rectangle * @param src source rectangle - * @return 1 if successful, 0 otherwise + * @return nonzero if successful, 0 otherwise */ -INLINE int gdi_CopyRect(HGDI_RECT dst, HGDI_RECT src) +INLINE BOOL gdi_CopyRect(HGDI_RECT dst, HGDI_RECT src) { dst->left = src->left; dst->top = src->top; dst->right = src->right; dst->bottom = src->bottom; - return 1; + return TRUE; } /** @@ -338,10 +339,10 @@ INLINE int gdi_CopyRect(HGDI_RECT dst, HGDI_RECT src) * @param rc rectangle * @param x point x position * @param y point y position - * @return 1 if the point is inside, 0 otherwise + * @return nonzero if the point is inside, 0 otherwise */ -INLINE int gdi_PtInRect(HGDI_RECT rc, int x, int y) +INLINE BOOL gdi_PtInRect(HGDI_RECT rc, int x, int y) { /* * points on the left and top sides are considered in, @@ -352,11 +353,11 @@ INLINE int gdi_PtInRect(HGDI_RECT rc, int x, int y) { if (y >= rc->top && y <= rc->bottom) { - return 1; + return TRUE; } } - return 0; + return FALSE; } /** @@ -367,7 +368,7 @@ INLINE int gdi_PtInRect(HGDI_RECT rc, int x, int y) * @param y y1 * @param w width * @param h height - * @return FALSE on error + * @return nonzero on success, 0 otherwise */ INLINE BOOL gdi_InvalidateRegion(HGDI_DC hdc, int x, int y, int w, int h) diff --git a/libfreerdp/gdi/shape.c b/libfreerdp/gdi/shape.c index 840c68771..fc7d61908 100644 --- a/libfreerdp/gdi/shape.c +++ b/libfreerdp/gdi/shape.c @@ -156,17 +156,18 @@ static void Ellipse_Bresenham(HGDI_DC hdc, int x1, int y1, int x2, int y2) /** * Draw an ellipse + * @msdn{dd162510} * @param hdc device context * @param nLeftRect x1 * @param nTopRect y1 * @param nRightRect x2 * @param nBottomRect y2 - * @return + * @return nonzero if successful, 0 otherwise */ -int gdi_Ellipse(HGDI_DC hdc, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect) +BOOL gdi_Ellipse(HGDI_DC hdc, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect) { Ellipse_Bresenham(hdc, nLeftRect, nTopRect, nRightRect, nBottomRect); - return 1; + return TRUE; } /** @@ -175,54 +176,57 @@ int gdi_Ellipse(HGDI_DC hdc, int nLeftRect, int nTopRect, int nRightRect, int nB * @param hdc device context * @param rect rectangle * @param hbr brush - * @return 1 if successful, 0 otherwise + * @return nonzero if successful, 0 otherwise */ -int gdi_FillRect(HGDI_DC hdc, HGDI_RECT rect, HGDI_BRUSH hbr) +BOOL gdi_FillRect(HGDI_DC hdc, HGDI_RECT rect, HGDI_BRUSH hbr) { p_FillRect _FillRect = FillRect_[IBPP(hdc->bitsPerPixel)]; - if (_FillRect != NULL) - return _FillRect(hdc, rect, hbr); - else - return 0; + if (_FillRect == NULL) + return FALSE; + + return _FillRect(hdc, rect, hbr); } /** - * + * Draw a polygon + * @msdn{dd162814} * @param hdc device context * @param lpPoints array of points * @param nCount number of points - * @return + * @return nonzero if successful, 0 otherwise */ -int gdi_Polygon(HGDI_DC hdc, GDI_POINT *lpPoints, int nCount) +BOOL gdi_Polygon(HGDI_DC hdc, GDI_POINT *lpPoints, int nCount) { - return 1; + return TRUE; } /** * Draw a series of closed polygons + * @msdn{dd162818} * @param hdc device context * @param lpPoints array of series of points * @param lpPolyCounts array of number of points in each series * @param nCount count of number of points in lpPolyCounts - * @return + * @return nonzero if successful, 0 otherwise */ -int gdi_PolyPolygon(HGDI_DC hdc, GDI_POINT *lpPoints, int *lpPolyCounts, int nCount) +BOOL gdi_PolyPolygon(HGDI_DC hdc, GDI_POINT *lpPoints, int *lpPolyCounts, int nCount) { - return 1; + return TRUE; } /** * Draw a rectangle + * @msdn{dd162898} * @param hdc device context * @param nLeftRect x1 * @param nTopRect y1 * @param nRightRect x2 * @param nBottomRect y2 - * @return + * @return nonzero if successful, 0 otherwise */ -int gdi_Rectangle(HGDI_DC hdc, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect) +BOOL gdi_Rectangle(HGDI_DC hdc, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect) { - return 1; + return TRUE; } diff --git a/libfreerdp/gdi/test/TestGdiBitBlt.c b/libfreerdp/gdi/test/TestGdiBitBlt.c index 1ff1c086f..d9f51d79a 100644 --- a/libfreerdp/gdi/test/TestGdiBitBlt.c +++ b/libfreerdp/gdi/test/TestGdiBitBlt.c @@ -652,106 +652,184 @@ int test_gdi_BitBlt_32bpp(void) gdi_SelectObject(hdcDst, (HGDIOBJECT) hBmpDst); /* SRCCOPY */ - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } if (test_assert_bitmaps_equal(hBmpDst, hBmp_SRCCOPY, "SRCCOPY") < 0) return -1; /* restore original destination bitmap */ gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpDstOriginal); - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } + gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpSrc); /* BLACKNESS */ - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_BLACKNESS); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_BLACKNESS)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } if (test_assert_bitmaps_equal(hBmpDst, hBmp_BLACKNESS, "BLACKNESS") < 0) return -1; /* restore original destination bitmap */ gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpDstOriginal); - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpSrc); /* WHITENESS */ - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_WHITENESS); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_WHITENESS)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } if (test_assert_bitmaps_equal(hBmpDst, hBmp_WHITENESS, "WHITENESS") < 0) return -1; /* restore original destination bitmap */ gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpDstOriginal); - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpSrc); /* SRCAND */ - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCAND); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCAND)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } if (test_assert_bitmaps_equal(hBmpDst, hBmp_SRCAND, "SRCAND") < 0) return -1; /* restore original destination bitmap */ gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpDstOriginal); - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } + gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpSrc); /* SRCPAINT */ - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCPAINT); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCPAINT)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } if (test_assert_bitmaps_equal(hBmpDst, hBmp_SRCPAINT, "SRCPAINT") < 0) return -1; /* restore original destination bitmap */ gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpDstOriginal); - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpSrc); /* SRCINVERT */ - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCINVERT); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCINVERT)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } if (test_assert_bitmaps_equal(hBmpDst, hBmp_SRCINVERT, "SRCINVERT") < 0) return -1; /* restore original destination bitmap */ gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpDstOriginal); - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpSrc); /* SRCERASE */ - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCERASE); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCERASE)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } if (test_assert_bitmaps_equal(hBmpDst, hBmp_SRCERASE, "SRCERASE") < 0) return -1; /* restore original destination bitmap */ gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpDstOriginal); - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpSrc); /* NOTSRCCOPY */ - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_NOTSRCCOPY); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_NOTSRCCOPY)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } //if (test_assert_bitmaps_equal(hBmpDst, hBmp_NOTSRCCOPY, "NOTSRCCOPY") < 0) // return -1; /* restore original destination bitmap */ gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpDstOriginal); - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpSrc); /* NOTSRCERASE */ - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_NOTSRCERASE); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_NOTSRCERASE)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } //if (test_assert_bitmaps_equal(hBmpDst, hBmp_NOTSRCERASE, "NOTSRCERASE") < 0) // return -1; /* restore original destination bitmap */ gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpDstOriginal); - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpSrc); /* DSTINVERT */ - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_DSTINVERT); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_DSTINVERT)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } //if (test_assert_bitmaps_equal(hBmpDst, hBmp_DSTINVERT, "DSTINVERT") < 0) // return -1; @@ -762,66 +840,114 @@ int test_gdi_BitBlt_32bpp(void) /* restore original destination bitmap */ gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpDstOriginal); - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpSrc); /* MERGECOPY */ - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_MERGECOPY); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_MERGECOPY)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } if (test_assert_bitmaps_equal(hBmpDst, hBmp_MERGECOPY, "MERGECOPY") < 0) return -1; /* restore original destination bitmap */ gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpDstOriginal); - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpSrc); /* MERGEPAINT */ - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_MERGEPAINT); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_MERGEPAINT)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } //if (test_assert_bitmaps_equal(hBmpDst, hBmp_MERGEPAINT, "MERGEPAINT") < 0) // return -1; /* restore original destination bitmap */ gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpDstOriginal); - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpSrc); /* PATCOPY */ - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_PATCOPY); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_PATCOPY)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } if (test_assert_bitmaps_equal(hBmpDst, hBmp_PATCOPY, "PATCOPY") < 0) return -1; /* restore original destination bitmap */ gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpDstOriginal); - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpSrc); /* PATINVERT */ - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_PATINVERT); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_PATINVERT)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } if (test_assert_bitmaps_equal(hBmpDst, hBmp_PATINVERT, "PATINVERT") < 0) return -1; /* restore original destination bitmap */ gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpDstOriginal); - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpSrc); /* PATPAINT */ - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_PATPAINT); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_PATPAINT)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } //if (test_assert_bitmaps_equal(hBmpDst, hBmp_PATPAINT, "PATPAINT") < 0) // return -1; /* restore original destination bitmap */ gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpDstOriginal); - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpSrc); /* SPna */ - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SPna); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SPna)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } if (test_assert_bitmaps_equal(hBmpDst, hBmp_SPna, "SPna") < 0) return -1; @@ -950,106 +1076,182 @@ int test_gdi_BitBlt_16bpp(void) gdi_SelectObject(hdcDst, (HGDIOBJECT) hBmpDst); /* SRCCOPY */ - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } if (test_assert_bitmaps_equal(hBmpDst, hBmp_SRCCOPY, "SRCCOPY") < 0) return -1; /* restore original destination bitmap */ gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpDstOriginal); - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpSrc); /* BLACKNESS */ - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_BLACKNESS); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_BLACKNESS)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } if (test_assert_bitmaps_equal(hBmpDst, hBmp_BLACKNESS, "BLACKNESS") < 0) return -1; /* restore original destination bitmap */ gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpDstOriginal); - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpSrc); /* WHITENESS */ - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_WHITENESS); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_WHITENESS)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } //if (test_assert_bitmaps_equal(hBmpDst, hBmp_WHITENESS, "WHITENESS") < 0) // return -1; /* restore original destination bitmap */ gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpDstOriginal); - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpSrc); /* SRCAND */ - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCAND); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCAND)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } if (test_assert_bitmaps_equal(hBmpDst, hBmp_SRCAND, "SRCAND") < 0) return -1; /* restore original destination bitmap */ gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpDstOriginal); - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpSrc); /* SRCPAINT */ - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCPAINT); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCPAINT)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } if (test_assert_bitmaps_equal(hBmpDst, hBmp_SRCPAINT, "SRCPAINT") < 0) return -1; /* restore original destination bitmap */ gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpDstOriginal); - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpSrc); /* SRCINVERT */ - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCINVERT); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCINVERT)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } if (test_assert_bitmaps_equal(hBmpDst, hBmp_SRCINVERT, "SRCINVERT") < 0) return -1; /* restore original destination bitmap */ gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpDstOriginal); - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpSrc); /* SRCERASE */ - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCERASE); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCERASE)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } if (test_assert_bitmaps_equal(hBmpDst, hBmp_SRCERASE, "SRCERASE") < 0) return -1; /* restore original destination bitmap */ gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpDstOriginal); - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpSrc); /* NOTSRCCOPY */ - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_NOTSRCCOPY); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_NOTSRCCOPY)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } //if (test_assert_bitmaps_equal(hBmpDst, hBmp_NOTSRCCOPY, "NOTSRCCOPY") < 0) // return -1; /* restore original destination bitmap */ gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpDstOriginal); - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpSrc); /* NOTSRCERASE */ - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_NOTSRCERASE); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_NOTSRCERASE)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } //if (test_assert_bitmaps_equal(hBmpDst, hBmp_NOTSRCERASE, "NOTSRCERASE") < 0) // return -1; /* restore original destination bitmap */ gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpDstOriginal); - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpSrc); /* DSTINVERT */ - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_DSTINVERT); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_DSTINVERT)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } //if (test_assert_bitmaps_equal(hBmpDst, hBmp_DSTINVERT, "DSTINVERT") < 0) // return -1; @@ -1060,66 +1262,114 @@ int test_gdi_BitBlt_16bpp(void) /* restore original destination bitmap */ gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpDstOriginal); - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpSrc); /* MERGECOPY */ - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_MERGECOPY); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_MERGECOPY)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } if (test_assert_bitmaps_equal(hBmpDst, hBmp_MERGECOPY, "MERGECOPY") < 0) return -1; /* restore original destination bitmap */ gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpDstOriginal); - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpSrc); /* MERGEPAINT */ - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_MERGEPAINT); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_MERGEPAINT)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } //if (test_assert_bitmaps_equal(hBmpDst, hBmp_MERGEPAINT, "MERGEPAINT") < 0) // return -1; /* restore original destination bitmap */ gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpDstOriginal); - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpSrc); /* PATCOPY */ - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_PATCOPY); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_PATCOPY)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } if (test_assert_bitmaps_equal(hBmpDst, hBmp_PATCOPY, "PATCOPY") < 0) return -1; /* restore original destination bitmap */ gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpDstOriginal); - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpSrc); /* PATINVERT */ - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_PATINVERT); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_PATINVERT)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } if (test_assert_bitmaps_equal(hBmpDst, hBmp_PATINVERT, "PATINVERT") < 0) return -1; /* restore original destination bitmap */ gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpDstOriginal); - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpSrc); /* PATPAINT */ - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_PATPAINT); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_PATPAINT)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } //if (test_assert_bitmaps_equal(hBmpDst, hBmp_PATPAINT, "PATPAINT") < 0) // return -1; /* restore original destination bitmap */ gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpDstOriginal); - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpSrc); /* SPna */ - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SPna); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SPna)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } if (test_assert_bitmaps_equal(hBmpDst, hBmp_SPna, "SPna") < 0) return -1; @@ -1248,106 +1498,182 @@ int test_gdi_BitBlt_8bpp(void) gdi_SelectObject(hdcDst, (HGDIOBJECT) hBmpDst); /* SRCCOPY */ - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } if (CompareBitmaps(hBmpDst, hBmp_SRCCOPY) != 1) return -1; /* restore original destination bitmap */ gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpDstOriginal); - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpSrc); /* BLACKNESS */ - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_BLACKNESS); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_BLACKNESS)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } if (test_assert_bitmaps_equal(hBmpDst, hBmp_BLACKNESS, "BLACKNESS") < 0) return -1; /* restore original destination bitmap */ gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpDstOriginal); - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpSrc); /* WHITENESS */ - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_WHITENESS); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_WHITENESS)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } //if (test_assert_bitmaps_equal(hBmpDst, hBmp_WHITENESS, "WHITENESS") < 0) // return -1; /* restore original destination bitmap */ gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpDstOriginal); - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpSrc); /* SRCAND */ - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCAND); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCAND)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } if (test_assert_bitmaps_equal(hBmpDst, hBmp_SRCAND, "SRCAND") < 0) return -1; /* restore original destination bitmap */ gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpDstOriginal); - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpSrc); /* SRCPAINT */ - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCPAINT); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCPAINT)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } if (test_assert_bitmaps_equal(hBmpDst, hBmp_SRCPAINT, "SRCPAINT") < 0) return -1; /* restore original destination bitmap */ gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpDstOriginal); - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpSrc); /* SRCINVERT */ - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCINVERT); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCINVERT)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } if (test_assert_bitmaps_equal(hBmpDst, hBmp_SRCINVERT, "SRCINVERT") < 0) return -1; /* restore original destination bitmap */ gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpDstOriginal); - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpSrc); /* SRCERASE */ - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCERASE); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCERASE)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } if (test_assert_bitmaps_equal(hBmpDst, hBmp_SRCERASE, "SRCERASE") < 0) return -1; /* restore original destination bitmap */ gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpDstOriginal); - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpSrc); /* NOTSRCCOPY */ - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_NOTSRCCOPY); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_NOTSRCCOPY)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } if (test_assert_bitmaps_equal(hBmpDst, hBmp_NOTSRCCOPY, "NOTSRCCOPY") < 0) return -1; /* restore original destination bitmap */ gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpDstOriginal); - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpSrc); /* NOTSRCERASE */ - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_NOTSRCERASE); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_NOTSRCERASE)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } if (test_assert_bitmaps_equal(hBmpDst, hBmp_NOTSRCERASE, "NOTSRCERASE") < 0) return -1; /* restore original destination bitmap */ gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpDstOriginal); - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpSrc); /* DSTINVERT */ - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_DSTINVERT); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_DSTINVERT)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } if (test_assert_bitmaps_equal(hBmpDst, hBmp_DSTINVERT, "DSTINVERT") < 0) return -1; @@ -1358,66 +1684,114 @@ int test_gdi_BitBlt_8bpp(void) /* restore original destination bitmap */ gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpDstOriginal); - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpSrc); /* MERGECOPY */ - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_MERGECOPY); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_MERGECOPY)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } if (test_assert_bitmaps_equal(hBmpDst, hBmp_MERGECOPY, "MERGECOPY") < 0) return -1; /* restore original destination bitmap */ gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpDstOriginal); - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpSrc); /* MERGEPAINT */ - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_MERGEPAINT); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_MERGEPAINT)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } if (test_assert_bitmaps_equal(hBmpDst, hBmp_MERGEPAINT, "MERGEPAINT") < 0) return -1; /* restore original destination bitmap */ gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpDstOriginal); - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpSrc); /* PATCOPY */ - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_PATCOPY); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_PATCOPY)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } if (test_assert_bitmaps_equal(hBmpDst, hBmp_PATCOPY, "PATCOPY") < 0) return -1; /* restore original destination bitmap */ gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpDstOriginal); - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpSrc); /* PATINVERT */ - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_PATINVERT); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_PATINVERT)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } if (test_assert_bitmaps_equal(hBmpDst, hBmp_PATINVERT, "PATINVERT") < 0) return -1; /* restore original destination bitmap */ gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpDstOriginal); - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpSrc); /* PATPAINT */ - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_PATPAINT); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_PATPAINT)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } if (test_assert_bitmaps_equal(hBmpDst, hBmp_PATPAINT, "PATPAINT") < 0) return -1; /* restore original destination bitmap */ gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpDstOriginal); - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SRCCOPY)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpSrc); /* SPna */ - gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SPna); + if (!gdi_BitBlt(hdcDst, 0, 0, 16, 16, hdcSrc, 0, 0, GDI_SPna)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } if (test_assert_bitmaps_equal(hBmpDst, hBmp_SPna, "SPna") < 0) return -1; diff --git a/libfreerdp/gdi/test/TestGdiClip.c b/libfreerdp/gdi/test/TestGdiClip.c index 98a62efdc..0bc95258b 100644 --- a/libfreerdp/gdi/test/TestGdiClip.c +++ b/libfreerdp/gdi/test/TestGdiClip.c @@ -14,7 +14,7 @@ int test_gdi_ClipCoords(void) { - int draw; + BOOL draw; HGDI_DC hdc; HGDI_RGN rgn1; HGDI_RGN rgn2; @@ -44,7 +44,7 @@ int test_gdi_ClipCoords(void) gdi_ClipCoords(hdc, &(rgn1->x), &(rgn1->y), &(rgn1->w), &(rgn1->h), NULL, NULL); - if (gdi_EqualRgn(rgn1, rgn2) != 1) + if (!gdi_EqualRgn(rgn1, rgn2)) return -1; /* region all inside clipping region */ @@ -54,7 +54,7 @@ int test_gdi_ClipCoords(void) gdi_ClipCoords(hdc, &(rgn1->x), &(rgn1->y), &(rgn1->w), &(rgn1->h), NULL, NULL); - if (gdi_EqualRgn(rgn1, rgn2) != 1) + if (!gdi_EqualRgn(rgn1, rgn2)) return -1; /* region all outside clipping region, on the left */ @@ -64,7 +64,7 @@ int test_gdi_ClipCoords(void) draw = gdi_ClipCoords(hdc, &(rgn1->x), &(rgn1->y), &(rgn1->w), &(rgn1->h), NULL, NULL); - if (draw != 0) + if (draw) return -1; /* region all outside clipping region, on the right */ @@ -74,7 +74,7 @@ int test_gdi_ClipCoords(void) draw = gdi_ClipCoords(hdc, &(rgn1->x), &(rgn1->y), &(rgn1->w), &(rgn1->h), NULL, NULL); - if (draw != 0) + if (draw) return -1; /* region all outside clipping region, on top */ @@ -84,7 +84,7 @@ int test_gdi_ClipCoords(void) draw = gdi_ClipCoords(hdc, &(rgn1->x), &(rgn1->y), &(rgn1->w), &(rgn1->h), NULL, NULL); - if (draw != 0) + if (draw) return -1; /* region all outside clipping region, at the bottom */ @@ -94,7 +94,7 @@ int test_gdi_ClipCoords(void) draw = gdi_ClipCoords(hdc, &(rgn1->x), &(rgn1->y), &(rgn1->w), &(rgn1->h), NULL, NULL); - if (draw != 0) + if (draw) return -1; /* left outside, right = clip, top = clip, bottom = clip */ @@ -104,7 +104,7 @@ int test_gdi_ClipCoords(void) gdi_ClipCoords(hdc, &(rgn1->x), &(rgn1->y), &(rgn1->w), &(rgn1->h), NULL, NULL); - if (gdi_EqualRgn(rgn1, rgn2) != 1) + if (!gdi_EqualRgn(rgn1, rgn2)) return -1; /* left outside, right inside, top = clip, bottom = clip */ @@ -114,7 +114,7 @@ int test_gdi_ClipCoords(void) gdi_ClipCoords(hdc, &(rgn1->x), &(rgn1->y), &(rgn1->w), &(rgn1->h), NULL, NULL); - if (gdi_EqualRgn(rgn1, rgn2) != 1) + if (!gdi_EqualRgn(rgn1, rgn2)) return -1; /* left = clip, right outside, top = clip, bottom = clip */ @@ -124,7 +124,7 @@ int test_gdi_ClipCoords(void) gdi_ClipCoords(hdc, &(rgn1->x), &(rgn1->y), &(rgn1->w), &(rgn1->h), NULL, NULL); - if (gdi_EqualRgn(rgn1, rgn2) != 1) + if (!gdi_EqualRgn(rgn1, rgn2)) return -1; /* left inside, right outside, top = clip, bottom = clip */ @@ -134,7 +134,7 @@ int test_gdi_ClipCoords(void) gdi_ClipCoords(hdc, &(rgn1->x), &(rgn1->y), &(rgn1->w), &(rgn1->h), NULL, NULL); - if (gdi_EqualRgn(rgn1, rgn2) != 1) + if (!gdi_EqualRgn(rgn1, rgn2)) return -1; /* top outside, bottom = clip, left = clip, right = clip */ @@ -144,7 +144,7 @@ int test_gdi_ClipCoords(void) gdi_ClipCoords(hdc, &(rgn1->x), &(rgn1->y), &(rgn1->w), &(rgn1->h), NULL, NULL); - if (gdi_EqualRgn(rgn1, rgn2) != 1) + if (!gdi_EqualRgn(rgn1, rgn2)) return -1; /* top = clip, bottom outside, left = clip, right = clip */ @@ -154,7 +154,7 @@ int test_gdi_ClipCoords(void) gdi_ClipCoords(hdc, &(rgn1->x), &(rgn1->y), &(rgn1->w), &(rgn1->h), NULL, NULL); - if (gdi_EqualRgn(rgn1, rgn2) != 1) + if (!gdi_EqualRgn(rgn1, rgn2)) return -1; /* top = clip, bottom = clip, top = clip, bottom = clip */ @@ -164,7 +164,7 @@ int test_gdi_ClipCoords(void) gdi_ClipCoords(hdc, &(rgn1->x), &(rgn1->y), &(rgn1->w), &(rgn1->h), NULL, NULL); - if (gdi_EqualRgn(rgn1, rgn2) != 1) + if (!gdi_EqualRgn(rgn1, rgn2)) return -1; return 0; @@ -210,7 +210,7 @@ int test_gdi_InvalidateRegion(void) gdi_InvalidateRegion(hdc, rgn1->x, rgn1->y, rgn1->w, rgn1->h); - if (gdi_EqualRgn(invalid, rgn2) != 1) + if (!gdi_EqualRgn(invalid, rgn2)) return -1; /* region same as invalid region */ @@ -220,7 +220,7 @@ int test_gdi_InvalidateRegion(void) gdi_InvalidateRegion(hdc, rgn1->x, rgn1->y, rgn1->w, rgn1->h); - if (gdi_EqualRgn(invalid, rgn2) != 1) + if (!gdi_EqualRgn(invalid, rgn2)) return -1; /* left outside */ @@ -230,7 +230,7 @@ int test_gdi_InvalidateRegion(void) gdi_InvalidateRegion(hdc, rgn1->x, rgn1->y, rgn1->w, rgn1->h); - if (gdi_EqualRgn(invalid, rgn2) != 1) + if (!gdi_EqualRgn(invalid, rgn2)) return -1; /* right outside */ @@ -240,7 +240,7 @@ int test_gdi_InvalidateRegion(void) gdi_InvalidateRegion(hdc, rgn1->x, rgn1->y, rgn1->w, rgn1->h); - if (gdi_EqualRgn(invalid, rgn2) != 1) + if (!gdi_EqualRgn(invalid, rgn2)) return -1; /* top outside */ @@ -250,7 +250,7 @@ int test_gdi_InvalidateRegion(void) gdi_InvalidateRegion(hdc, rgn1->x, rgn1->y, rgn1->w, rgn1->h); - if (gdi_EqualRgn(invalid, rgn2) != 1) + if (!gdi_EqualRgn(invalid, rgn2)) return -1; /* bottom outside */ @@ -260,7 +260,7 @@ int test_gdi_InvalidateRegion(void) gdi_InvalidateRegion(hdc, rgn1->x, rgn1->y, rgn1->w, rgn1->h); - if (gdi_EqualRgn(invalid, rgn2) != 1) + if (!gdi_EqualRgn(invalid, rgn2)) return -1; /* left outside, right outside */ @@ -270,7 +270,7 @@ int test_gdi_InvalidateRegion(void) gdi_InvalidateRegion(hdc, rgn1->x, rgn1->y, rgn1->w, rgn1->h); - if (gdi_EqualRgn(invalid, rgn2) != 1) + if (!gdi_EqualRgn(invalid, rgn2)) return -1; /* top outside, bottom outside */ @@ -280,7 +280,7 @@ int test_gdi_InvalidateRegion(void) gdi_InvalidateRegion(hdc, rgn1->x, rgn1->y, rgn1->w, rgn1->h); - if (gdi_EqualRgn(invalid, rgn2) != 1) + if (!gdi_EqualRgn(invalid, rgn2)) return -1; /* all outside, left */ @@ -290,7 +290,7 @@ int test_gdi_InvalidateRegion(void) gdi_InvalidateRegion(hdc, rgn1->x, rgn1->y, rgn1->w, rgn1->h); - if (gdi_EqualRgn(invalid, rgn2) != 1) + if (!gdi_EqualRgn(invalid, rgn2)) return -1; /* all outside, right */ @@ -300,7 +300,7 @@ int test_gdi_InvalidateRegion(void) gdi_InvalidateRegion(hdc, rgn1->x, rgn1->y, rgn1->w, rgn1->h); - if (gdi_EqualRgn(invalid, rgn2) != 1) + if (!gdi_EqualRgn(invalid, rgn2)) return -1; /* all outside, top */ @@ -310,7 +310,7 @@ int test_gdi_InvalidateRegion(void) gdi_InvalidateRegion(hdc, rgn1->x, rgn1->y, rgn1->w, rgn1->h); - if (gdi_EqualRgn(invalid, rgn2) != 1) + if (!gdi_EqualRgn(invalid, rgn2)) return -1; /* all outside, bottom */ @@ -320,7 +320,7 @@ int test_gdi_InvalidateRegion(void) gdi_InvalidateRegion(hdc, rgn1->x, rgn1->y, rgn1->w, rgn1->h); - if (gdi_EqualRgn(invalid, rgn2) != 1) + if (!gdi_EqualRgn(invalid, rgn2)) return -1; /* all outside */ @@ -330,7 +330,7 @@ int test_gdi_InvalidateRegion(void) gdi_InvalidateRegion(hdc, rgn1->x, rgn1->y, rgn1->w, rgn1->h); - if (gdi_EqualRgn(invalid, rgn2) != 1) + if (!gdi_EqualRgn(invalid, rgn2)) return -1; /* everything */ @@ -340,7 +340,7 @@ int test_gdi_InvalidateRegion(void) gdi_InvalidateRegion(hdc, rgn1->x, rgn1->y, rgn1->w, rgn1->h); - if (gdi_EqualRgn(invalid, rgn2) != 1) + if (!gdi_EqualRgn(invalid, rgn2)) return -1; return 0; diff --git a/libfreerdp/gdi/test/TestGdiCreate.c b/libfreerdp/gdi/test/TestGdiCreate.c index 6dd55dfd2..584d68362 100644 --- a/libfreerdp/gdi/test/TestGdiCreate.c +++ b/libfreerdp/gdi/test/TestGdiCreate.c @@ -48,7 +48,11 @@ int test_gdi_CreateCompatibleDC(void) hdc->bitsPerPixel = 16; hdc->drawMode = GDI_R2_XORPEN; - chdc = gdi_CreateCompatibleDC(hdc); + if (!(chdc = gdi_CreateCompatibleDC(hdc))) + { + printf("gdi_CreateCompatibleDC failed\n"); + return -1; + } if (chdc->bytesPerPixel != hdc->bytesPerPixel) return -1; @@ -73,8 +77,17 @@ int test_gdi_CreateBitmap(void) bpp = 32; width = 32; height = 16; - data = (BYTE*) malloc(width * height * 4); - hBitmap = gdi_CreateBitmap(width, height, bpp, data); + if (!(data = (BYTE*) _aligned_malloc(width * height * 4, 16))) + { + printf("failed to allocate aligned bitmap data memory\n"); + return -1; + } + + if (!(hBitmap = gdi_CreateBitmap(width, height, bpp, data))) + { + printf("gdi_CreateBitmap failed\n"); + return -1; + } if (hBitmap->objectType != GDIOBJECT_BITMAP) return -1; @@ -143,6 +156,12 @@ int test_gdi_CreatePen(void) { HGDI_PEN hPen = gdi_CreatePen(GDI_PS_SOLID, 8, 0xAABBCCDD); + if (!hPen) + { + printf("gdi_CreatePen failed\n"); + return -1; + } + if (hPen->style != GDI_PS_SOLID) return -1; @@ -231,14 +250,17 @@ int test_gdi_CreateRectRgn(void) int test_gdi_CreateRect(void) { + HGDI_RECT hRect; int x1 = 32; int y1 = 64; int x2 = 128; int y2 = 256; - HGDI_RECT hRect = gdi_CreateRect(x1, y1, x2, y2); - if (!hRect) + if (!(hRect = gdi_CreateRect(x1, y1, x2, y2))) + { + printf("gdi_CreateRect failed\n"); return -1; + } if (hRect->objectType != GDIOBJECT_RECT) return -1; @@ -356,7 +378,12 @@ int test_gdi_MoveToEx(void) return -1; } - hPen = gdi_CreatePen(GDI_PS_SOLID, 8, 0xAABBCCDD); + if (!(hPen = gdi_CreatePen(GDI_PS_SOLID, 8, 0xAABBCCDD))) + { + printf("gdi_CreatePen failed\n"); + return -1; + } + gdi_SelectObject(hdc, (HGDIOBJECT) hPen); gdi_MoveToEx(hdc, 128, 256, NULL); diff --git a/libfreerdp/gdi/test/TestGdiEllipse.c b/libfreerdp/gdi/test/TestGdiEllipse.c index fcebb9feb..7d3b107e6 100644 --- a/libfreerdp/gdi/test/TestGdiEllipse.c +++ b/libfreerdp/gdi/test/TestGdiEllipse.c @@ -101,7 +101,12 @@ int TestGdiEllipse(int argc, char* argv[]) hdc->bytesPerPixel = bytesPerPixel; gdi_SetNullClipRgn(hdc); - pen = gdi_CreatePen(1, 1, 0); + if (!(pen = gdi_CreatePen(1, 1, 0))) + { + printf("gdi_CreatePen failed\n"); + return -1; + } + gdi_SelectObject(hdc, (HGDIOBJECT) pen); hBmp = gdi_CreateCompatibleBitmap(hdc, 16, 16); @@ -124,7 +129,11 @@ int TestGdiEllipse(int argc, char* argv[]) hBmp_Ellipse_3 = gdi_CreateBitmap(16, 16, bitsPerPixel, data); /* Test Case 1: (0,0) -> (16, 16) */ - gdi_BitBlt(hdc, 0, 0, 16, 16, hdc, 0, 0, GDI_WHITENESS); + if (!gdi_BitBlt(hdc, 0, 0, 16, 16, hdc, 0, 0, GDI_WHITENESS)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_Ellipse(hdc, 0, 0, 16, 16); return 0; diff --git a/libfreerdp/gdi/test/TestGdiLine.c b/libfreerdp/gdi/test/TestGdiLine.c index 77ca2fe4a..1ae64a030 100644 --- a/libfreerdp/gdi/test/TestGdiLine.c +++ b/libfreerdp/gdi/test/TestGdiLine.c @@ -648,7 +648,12 @@ int TestGdiLine(int argc, char* argv[]) hdc->bytesPerPixel = bytesPerPixel; gdi_SetNullClipRgn(hdc); - pen = gdi_CreatePen(1, 1, 0); + if (!(pen = gdi_CreatePen(1, 1, 0))) + { + printf("gdi_CreatePen failed\n"); + return -1; + } + gdi_SelectObject(hdc, (HGDIOBJECT) pen); hBmp = gdi_CreateCompatibleBitmap(hdc, 16, 16); @@ -746,7 +751,11 @@ int TestGdiLine(int argc, char* argv[]) hBmp_LineTo_R2_WHITE = gdi_CreateBitmap(16, 16, bitsPerPixel, data); /* Test Case 1: (0,0) -> (15, 15) */ - gdi_BitBlt(hdc, 0, 0, 16, 16, hdc, 0, 0, GDI_WHITENESS); + if (!gdi_BitBlt(hdc, 0, 0, 16, 16, hdc, 0, 0, GDI_WHITENESS)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_MoveToEx(hdc, 0, 0, NULL); gdi_LineTo(hdc, 15, 15); @@ -754,7 +763,11 @@ int TestGdiLine(int argc, char* argv[]) return -1; /* Test Case 2: (15,15) -> (0,0) */ - gdi_BitBlt(hdc, 0, 0, 16, 16, hdc, 0, 0, GDI_WHITENESS); + if (!gdi_BitBlt(hdc, 0, 0, 16, 16, hdc, 0, 0, GDI_WHITENESS)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_MoveToEx(hdc, 15, 15, NULL); gdi_LineTo(hdc, 0, 0); @@ -762,7 +775,11 @@ int TestGdiLine(int argc, char* argv[]) return -1; /* Test Case 3: (15,0) -> (0,15) */ - gdi_BitBlt(hdc, 0, 0, 16, 16, hdc, 0, 0, GDI_WHITENESS); + if (!gdi_BitBlt(hdc, 0, 0, 16, 16, hdc, 0, 0, GDI_WHITENESS)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_MoveToEx(hdc, 15, 0, NULL); gdi_LineTo(hdc, 0, 15); @@ -770,7 +787,11 @@ int TestGdiLine(int argc, char* argv[]) return -1; /* Test Case 4: (0,15) -> (15,0) */ - gdi_BitBlt(hdc, 0, 0, 16, 16, hdc, 0, 0, GDI_WHITENESS); + if (!gdi_BitBlt(hdc, 0, 0, 16, 16, hdc, 0, 0, GDI_WHITENESS)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_MoveToEx(hdc, 0, 15, NULL); gdi_LineTo(hdc, 15, 0); @@ -778,7 +799,11 @@ int TestGdiLine(int argc, char* argv[]) return -1; /* Test Case 5: (0,8) -> (15,8) */ - gdi_BitBlt(hdc, 0, 0, 16, 16, hdc, 0, 0, GDI_WHITENESS); + if (!gdi_BitBlt(hdc, 0, 0, 16, 16, hdc, 0, 0, GDI_WHITENESS)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_MoveToEx(hdc, 0, 8, NULL); gdi_LineTo(hdc, 15, 8); @@ -786,7 +811,11 @@ int TestGdiLine(int argc, char* argv[]) return -1; /* Test Case 6: (15,8) -> (0,8) */ - gdi_BitBlt(hdc, 0, 0, 16, 16, hdc, 0, 0, GDI_WHITENESS); + if (!gdi_BitBlt(hdc, 0, 0, 16, 16, hdc, 0, 0, GDI_WHITENESS)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_MoveToEx(hdc, 15, 8, NULL); gdi_LineTo(hdc, 0, 8); @@ -794,7 +823,11 @@ int TestGdiLine(int argc, char* argv[]) return -1; /* Test Case 7: (8,0) -> (8,15) */ - gdi_BitBlt(hdc, 0, 0, 16, 16, hdc, 0, 0, GDI_WHITENESS); + if (!gdi_BitBlt(hdc, 0, 0, 16, 16, hdc, 0, 0, GDI_WHITENESS)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_MoveToEx(hdc, 8, 0, NULL); gdi_LineTo(hdc, 8, 15); @@ -802,7 +835,11 @@ int TestGdiLine(int argc, char* argv[]) return -1; /* Test Case 8: (8,15) -> (8,0) */ - gdi_BitBlt(hdc, 0, 0, 16, 16, hdc, 0, 0, GDI_WHITENESS); + if (!gdi_BitBlt(hdc, 0, 0, 16, 16, hdc, 0, 0, GDI_WHITENESS)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_MoveToEx(hdc, 8, 15, NULL); gdi_LineTo(hdc, 8, 0); @@ -810,7 +847,11 @@ int TestGdiLine(int argc, char* argv[]) return -1; /* Test Case 9: (4,4) -> (12,12) */ - gdi_BitBlt(hdc, 0, 0, 16, 16, hdc, 0, 0, GDI_WHITENESS); + if (!gdi_BitBlt(hdc, 0, 0, 16, 16, hdc, 0, 0, GDI_WHITENESS)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_MoveToEx(hdc, 4, 4, NULL); gdi_LineTo(hdc, 12, 12); @@ -818,7 +859,11 @@ int TestGdiLine(int argc, char* argv[]) return -1; /* Test Case 10: (12,12) -> (4,4) */ - gdi_BitBlt(hdc, 0, 0, 16, 16, hdc, 0, 0, GDI_WHITENESS); + if (!gdi_BitBlt(hdc, 0, 0, 16, 16, hdc, 0, 0, GDI_WHITENESS)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_MoveToEx(hdc, 12, 12, NULL); gdi_LineTo(hdc, 4, 4); @@ -826,7 +871,11 @@ int TestGdiLine(int argc, char* argv[]) return -1; /* Test Case 11: (0,0) -> (+10,+10) */ - gdi_BitBlt(hdc, 0, 0, 16, 16, hdc, 0, 0, GDI_WHITENESS); + if (!gdi_BitBlt(hdc, 0, 0, 16, 16, hdc, 0, 0, GDI_WHITENESS)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_SetClipRgn(hdc, 0, 0, 16, 16); gdi_MoveToEx(hdc, 0, 0, NULL); gdi_LineTo(hdc, 16 + 10, 16 + 10); @@ -835,7 +884,11 @@ int TestGdiLine(int argc, char* argv[]) return -1; /* Test Case 12: (0,0) -> (16,16), R2_BLACK */ - gdi_BitBlt(hdc, 0, 0, 16, 16, hdc, 0, 0, GDI_WHITENESS); + if (!gdi_BitBlt(hdc, 0, 0, 16, 16, hdc, 0, 0, GDI_WHITENESS)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_SetClipRgn(hdc, 0, 0, 16, 16); gdi_MoveToEx(hdc, 0, 0, NULL); gdi_SetROP2(hdc, GDI_R2_BLACK); @@ -845,7 +898,11 @@ int TestGdiLine(int argc, char* argv[]) return -1; /* Test Case 13: (0,0) -> (16,16), R2_NOTMERGEPEN */ - gdi_BitBlt(hdc, 0, 0, 16, 16, hdc, 0, 0, GDI_WHITENESS); + if (!gdi_BitBlt(hdc, 0, 0, 16, 16, hdc, 0, 0, GDI_WHITENESS)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_SetClipRgn(hdc, 0, 0, 16, 16); gdi_MoveToEx(hdc, 0, 0, NULL); gdi_SetROP2(hdc, GDI_R2_NOTMERGEPEN); @@ -855,7 +912,11 @@ int TestGdiLine(int argc, char* argv[]) return -1; /* Test Case 14: (0,0) -> (16,16), R2_MASKNOTPEN */ - gdi_BitBlt(hdc, 0, 0, 16, 16, hdc, 0, 0, GDI_WHITENESS); + if (!gdi_BitBlt(hdc, 0, 0, 16, 16, hdc, 0, 0, GDI_WHITENESS)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_SetClipRgn(hdc, 0, 0, 16, 16); gdi_MoveToEx(hdc, 0, 0, NULL); gdi_SetROP2(hdc, GDI_R2_MASKNOTPEN); @@ -865,7 +926,11 @@ int TestGdiLine(int argc, char* argv[]) return -1; /* Test Case 15: (0,0) -> (16,16), R2_NOTCOPYPEN */ - gdi_BitBlt(hdc, 0, 0, 16, 16, hdc, 0, 0, GDI_WHITENESS); + if (!gdi_BitBlt(hdc, 0, 0, 16, 16, hdc, 0, 0, GDI_WHITENESS)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_SetClipRgn(hdc, 0, 0, 16, 16); gdi_MoveToEx(hdc, 0, 0, NULL); gdi_SetROP2(hdc, GDI_R2_NOTCOPYPEN); @@ -875,7 +940,11 @@ int TestGdiLine(int argc, char* argv[]) return -1; /* Test Case 16: (0,0) -> (16,16), R2_MASKPENNOT */ - gdi_BitBlt(hdc, 0, 0, 16, 16, hdc, 0, 0, GDI_WHITENESS); + if (!gdi_BitBlt(hdc, 0, 0, 16, 16, hdc, 0, 0, GDI_WHITENESS)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_SetClipRgn(hdc, 0, 0, 16, 16); gdi_MoveToEx(hdc, 0, 0, NULL); gdi_SetROP2(hdc, GDI_R2_MASKPENNOT); @@ -885,7 +954,11 @@ int TestGdiLine(int argc, char* argv[]) return -1; /* Test Case 17: (0,0) -> (16,16), R2_NOT */ - gdi_BitBlt(hdc, 0, 0, 16, 16, hdc, 0, 0, GDI_WHITENESS); + if (!gdi_BitBlt(hdc, 0, 0, 16, 16, hdc, 0, 0, GDI_WHITENESS)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_SetClipRgn(hdc, 0, 0, 16, 16); gdi_MoveToEx(hdc, 0, 0, NULL); gdi_SetROP2(hdc, GDI_R2_NOT); @@ -895,7 +968,11 @@ int TestGdiLine(int argc, char* argv[]) return -1; /* Test Case 18: (0,0) -> (16,16), R2_XORPEN */ - gdi_BitBlt(hdc, 0, 0, 16, 16, hdc, 0, 0, GDI_WHITENESS); + if (!gdi_BitBlt(hdc, 0, 0, 16, 16, hdc, 0, 0, GDI_WHITENESS)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_SetClipRgn(hdc, 0, 0, 16, 16); gdi_MoveToEx(hdc, 0, 0, NULL); gdi_SetROP2(hdc, GDI_R2_XORPEN); @@ -905,7 +982,11 @@ int TestGdiLine(int argc, char* argv[]) return -1; /* Test Case 19: (0,0) -> (16,16), R2_NOTMASKPEN */ - gdi_BitBlt(hdc, 0, 0, 16, 16, hdc, 0, 0, GDI_WHITENESS); + if (!gdi_BitBlt(hdc, 0, 0, 16, 16, hdc, 0, 0, GDI_WHITENESS)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_SetClipRgn(hdc, 0, 0, 16, 16); gdi_MoveToEx(hdc, 0, 0, NULL); gdi_SetROP2(hdc, GDI_R2_NOTMASKPEN); @@ -915,7 +996,11 @@ int TestGdiLine(int argc, char* argv[]) return -1; /* Test Case 20: (0,0) -> (16,16), R2_MASKPEN */ - gdi_BitBlt(hdc, 0, 0, 16, 16, hdc, 0, 0, GDI_WHITENESS); + if (!gdi_BitBlt(hdc, 0, 0, 16, 16, hdc, 0, 0, GDI_WHITENESS)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_SetClipRgn(hdc, 0, 0, 16, 16); gdi_MoveToEx(hdc, 0, 0, NULL); gdi_SetROP2(hdc, GDI_R2_MASKPEN); @@ -925,7 +1010,11 @@ int TestGdiLine(int argc, char* argv[]) return -1; /* Test Case 21: (0,0) -> (16,16), R2_NOTXORPEN */ - gdi_BitBlt(hdc, 0, 0, 16, 16, hdc, 0, 0, GDI_WHITENESS); + if (!gdi_BitBlt(hdc, 0, 0, 16, 16, hdc, 0, 0, GDI_WHITENESS)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_SetClipRgn(hdc, 0, 0, 16, 16); gdi_MoveToEx(hdc, 0, 0, NULL); gdi_SetROP2(hdc, GDI_R2_NOTXORPEN); @@ -935,7 +1024,11 @@ int TestGdiLine(int argc, char* argv[]) return -1; /* Test Case 22: (0,0) -> (16,16), R2_NOP */ - gdi_BitBlt(hdc, 0, 0, 16, 16, hdc, 0, 0, GDI_WHITENESS); + if (!gdi_BitBlt(hdc, 0, 0, 16, 16, hdc, 0, 0, GDI_WHITENESS)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_SetClipRgn(hdc, 0, 0, 16, 16); gdi_MoveToEx(hdc, 0, 0, NULL); gdi_SetROP2(hdc, GDI_R2_NOP); @@ -945,7 +1038,11 @@ int TestGdiLine(int argc, char* argv[]) return -1; /* Test Case 23: (0,0) -> (16,16), R2_MERGENOTPEN */ - gdi_BitBlt(hdc, 0, 0, 16, 16, hdc, 0, 0, GDI_WHITENESS); + if (!gdi_BitBlt(hdc, 0, 0, 16, 16, hdc, 0, 0, GDI_WHITENESS)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_SetClipRgn(hdc, 0, 0, 16, 16); gdi_MoveToEx(hdc, 0, 0, NULL); gdi_SetROP2(hdc, GDI_R2_MERGENOTPEN); @@ -955,7 +1052,11 @@ int TestGdiLine(int argc, char* argv[]) return -1; /* Test Case 24: (0,0) -> (16,16), R2_COPYPEN */ - gdi_BitBlt(hdc, 0, 0, 16, 16, hdc, 0, 0, GDI_WHITENESS); + if (!gdi_BitBlt(hdc, 0, 0, 16, 16, hdc, 0, 0, GDI_WHITENESS)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_SetClipRgn(hdc, 0, 0, 16, 16); gdi_MoveToEx(hdc, 0, 0, NULL); gdi_SetROP2(hdc, GDI_R2_COPYPEN); @@ -965,7 +1066,11 @@ int TestGdiLine(int argc, char* argv[]) return -1; /* Test Case 25: (0,0) -> (16,16), R2_MERGEPENNOT */ - gdi_BitBlt(hdc, 0, 0, 16, 16, hdc, 0, 0, GDI_WHITENESS); + if (!gdi_BitBlt(hdc, 0, 0, 16, 16, hdc, 0, 0, GDI_WHITENESS)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_SetClipRgn(hdc, 0, 0, 16, 16); gdi_MoveToEx(hdc, 0, 0, NULL); gdi_SetROP2(hdc, GDI_R2_MERGEPENNOT); @@ -975,7 +1080,11 @@ int TestGdiLine(int argc, char* argv[]) return -1; /* Test Case 26: (0,0) -> (16,16), R2_MERGEPEN */ - gdi_BitBlt(hdc, 0, 0, 16, 16, hdc, 0, 0, GDI_WHITENESS); + if (!gdi_BitBlt(hdc, 0, 0, 16, 16, hdc, 0, 0, GDI_WHITENESS)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_SetClipRgn(hdc, 0, 0, 16, 16); gdi_MoveToEx(hdc, 0, 0, NULL); gdi_SetROP2(hdc, GDI_R2_MERGEPEN); @@ -985,7 +1094,11 @@ int TestGdiLine(int argc, char* argv[]) return -1; /* Test Case 27: (0,0) -> (16,16), R2_WHITE */ - gdi_BitBlt(hdc, 0, 0, 16, 16, hdc, 0, 0, GDI_WHITENESS); + if (!gdi_BitBlt(hdc, 0, 0, 16, 16, hdc, 0, 0, GDI_WHITENESS)) + { + printf("gdi_BitBlt failed (line #%u)\n", __LINE__); + return -1; + } gdi_SetClipRgn(hdc, 0, 0, 16, 16); gdi_MoveToEx(hdc, 0, 0, NULL); gdi_SetROP2(hdc, GDI_R2_WHITE); diff --git a/libfreerdp/gdi/test/TestGdiRect.c b/libfreerdp/gdi/test/TestGdiRect.c index e5f7dfab4..e653e8608 100644 --- a/libfreerdp/gdi/test/TestGdiRect.c +++ b/libfreerdp/gdi/test/TestGdiRect.c @@ -24,33 +24,37 @@ int test_gdi_PtInRect(void) int right = 60; int bottom = 80; - hRect = gdi_CreateRect(left, top, right, bottom); + if (!(hRect = gdi_CreateRect(left, top, right, bottom))) + { + printf("gdi_CreateRect failed\n"); + return -1; + } - if (gdi_PtInRect(hRect, 0, 0) != 0) + if (gdi_PtInRect(hRect, 0, 0)) return -1; - if (gdi_PtInRect(hRect, 500, 500) != 0) + if (gdi_PtInRect(hRect, 500, 500)) return -1; - if (gdi_PtInRect(hRect, 40, 100) != 0) + if (gdi_PtInRect(hRect, 40, 100)) return -1; - if (gdi_PtInRect(hRect, 10, 40) != 0) + if (gdi_PtInRect(hRect, 10, 40)) return -1; - if (gdi_PtInRect(hRect, 30, 50) != 1) + if (!gdi_PtInRect(hRect, 30, 50)) return -1; - if (gdi_PtInRect(hRect, left, top) != 1) + if (!gdi_PtInRect(hRect, left, top)) return -1; - if (gdi_PtInRect(hRect, right, bottom) != 1) + if (!gdi_PtInRect(hRect, right, bottom)) return -1; - if (gdi_PtInRect(hRect, right, 60) != 1) + if (!gdi_PtInRect(hRect, right, 60)) return -1; - if (gdi_PtInRect(hRect, 40, bottom) != 1) + if (!gdi_PtInRect(hRect, 40, bottom)) return -1; return 0; @@ -86,7 +90,11 @@ int test_gdi_FillRect(void) hdc->bytesPerPixel = 4; hdc->bitsPerPixel = 32; - hRect = gdi_CreateRect(left, top, right, bottom); + if (!(hRect = gdi_CreateRect(left, top, right, bottom))) + { + printf("gdi_CreateRect failed\n"); + return -1; + } hBitmap = gdi_CreateCompatibleBitmap(hdc, width, height); ZeroMemory(hBitmap->data, width * height * hdc->bytesPerPixel);