20#ifndef FREERDP_LIB_GDI_CORE_H 
   21#define FREERDP_LIB_GDI_CORE_H 
   23#include <winpr/cast.h> 
   28#include <freerdp/api.h> 
   30FREERDP_LOCAL BOOL gdi_bitmap_update(rdpContext* context, 
const BITMAP_UPDATE* bitmapUpdate);
 
   32FREERDP_LOCAL gdiBitmap* gdi_bitmap_new_ex(rdpGdi* gdi, 
int width, 
int height, 
int bpp, BYTE* data);
 
   33FREERDP_LOCAL 
void gdi_bitmap_free_ex(gdiBitmap* gdi_bmp);
 
   35static inline BYTE* gdi_get_bitmap_pointer(
HGDI_DC hdcBmp, INT32 x, INT32 y)
 
   39  if ((x >= 0) && (y >= 0) && (x < hBmp->width) && (y < hBmp->height))
 
   41    BYTE* p = hBmp->data + (WINPR_ASSERTING_INT_CAST(
size_t, y) * hBmp->scanline) +
 
   42              (WINPR_ASSERTING_INT_CAST(
size_t, x) * FreeRDPGetBytesPerPixel(hdcBmp->format));
 
   47    WLog_ERR(FREERDP_TAG(
"gdi"),
 
   48             "gdi_get_bitmap_pointer: requesting invalid pointer: (%" PRIu32 
",%" PRIu32
 
   49             ") in %" PRIu32 
"x%" PRIu32 
"",
 
   50             x, y, hBmp->width, hBmp->height);
 
   62static inline BYTE* gdi_get_brush_pointer(
HGDI_DC hdcBrush, UINT32 x, UINT32 y)
 
   65  UINT32 brushStyle = gdi_GetBrushStyle(hdcBrush);
 
   77      const UINT32 w = WINPR_ASSERTING_INT_CAST(UINT32, hBmpBrush->width);
 
   78      const UINT32 h = WINPR_ASSERTING_INT_CAST(UINT32, hBmpBrush->height);
 
   82      x = (x + w - (WINPR_ASSERTING_INT_CAST(UINT32, hdcBrush->brush->nXOrg) % w)) % w;
 
   83      y = (y + h - (WINPR_ASSERTING_INT_CAST(UINT32, hdcBrush->brush->nYOrg) % h)) % h;
 
   84      p = hBmpBrush->data + (1ULL * y * hBmpBrush->scanline) +
 
   85          (1ULL * x * FreeRDPGetBytesPerPixel(hBmpBrush->format));
 
   93  p = (BYTE*)&(hdcBrush->textColor);