2#include <freerdp/gdi/gdi.h> 
    4#include <freerdp/gdi/dc.h> 
    5#include <freerdp/gdi/pen.h> 
    6#include <freerdp/gdi/shape.h> 
    7#include <freerdp/gdi/region.h> 
    8#include <freerdp/gdi/bitmap.h> 
   11#include <winpr/print.h> 
   17static int test_gdi_PtInRect(
void)
 
   26  if (!(hRect = gdi_CreateRect(
 
   27            WINPR_ASSERTING_INT_CAST(
int, left), WINPR_ASSERTING_INT_CAST(
int, top),
 
   28            WINPR_ASSERTING_INT_CAST(
int, right), WINPR_ASSERTING_INT_CAST(
int, bottom))))
 
   30    printf(
"gdi_CreateRect failed\n");
 
   34  if (gdi_PtInRect(hRect, 0, 0))
 
   37  if (gdi_PtInRect(hRect, 500, 500))
 
   40  if (gdi_PtInRect(hRect, 40, 100))
 
   43  if (gdi_PtInRect(hRect, 10, 40))
 
   46  if (!gdi_PtInRect(hRect, 30, 50))
 
   49  if (!gdi_PtInRect(hRect, WINPR_ASSERTING_INT_CAST(
int, left),
 
   50                    WINPR_ASSERTING_INT_CAST(
int, top)))
 
   53  if (!gdi_PtInRect(hRect, WINPR_ASSERTING_INT_CAST(
int, right),
 
   54                    WINPR_ASSERTING_INT_CAST(
int, bottom)))
 
   57  if (!gdi_PtInRect(hRect, WINPR_ASSERTING_INT_CAST(
int, right), 60))
 
   60  if (!gdi_PtInRect(hRect, 40, WINPR_ASSERTING_INT_CAST(
int, bottom)))
 
   69static int test_gdi_FillRect(
void)
 
   80  UINT32 goodPixels = 0;
 
   88  if (!(hdc = gdi_GetDC()))
 
   90    printf(
"failed to get gdi device context\n");
 
   94  hdc->format = PIXEL_FORMAT_XRGB32;
 
   96  if (!(hRect = gdi_CreateRect(
 
   97            WINPR_ASSERTING_INT_CAST(
int, left), WINPR_ASSERTING_INT_CAST(
int, top),
 
   98            WINPR_ASSERTING_INT_CAST(
int, right), WINPR_ASSERTING_INT_CAST(
int, bottom))))
 
  100    printf(
"gdi_CreateRect failed\n");
 
  104  hBitmap = gdi_CreateCompatibleBitmap(hdc, width, height);
 
  105  ZeroMemory(hBitmap->data, 1ULL * width * height * FreeRDPGetBytesPerPixel(hdc->format));
 
  107  color = FreeRDPGetColor(PIXEL_FORMAT_ARGB32, 0xAA, 0xBB, 0xCC, 0xFF);
 
  108  hBrush = gdi_CreateSolidBrush(color);
 
  109  gdi_FillRect(hdc, hRect, hBrush);
 
  113  for (UINT32 x = 0; x < width; x++)
 
  115    for (UINT32 y = 0; y < height; y++)
 
  117      rawPixel = gdi_GetPixel(hdc, x, y);
 
  118      pixel = FreeRDPConvertColor(rawPixel, hdc->format, PIXEL_FORMAT_ARGB32, NULL);
 
  120      if (gdi_PtInRect(hRect, WINPR_ASSERTING_INT_CAST(
int, x),
 
  121                       WINPR_ASSERTING_INT_CAST(
int, y)))
 
  129          printf(
"actual:%08" PRIX32 
" expected:%08" PRIX32 
"\n", gdi_GetPixel(hdc, x, y),
 
  148  if (goodPixels != width * height)
 
  163int TestGdiRect(
int argc, 
char* argv[])
 
  168  if (test_gdi_PtInRect() < 0)
 
  171  if (test_gdi_FillRect() < 0)