// gdi32.c - Win32 Graphics Device Interface stubs #include #include // --------------------------------------------------------------------------- // Syscall stubs (from syscall.dll) // --------------------------------------------------------------------------- extern void SysScreenBlit(int x, int y, int w, int h, const uint32_t* pixels); // --------------------------------------------------------------------------- // Win32 Base Types // --------------------------------------------------------------------------- typedef void* HDC; typedef unsigned long DWORD; typedef unsigned short WORD; typedef unsigned int UINT; typedef long LONG; typedef int BOOL; #define TRUE 1 #define FALSE 0 // StretchDIBits Constants #define BI_RGB 0L #define DIB_RGB_COLORS 0 #define SRCCOPY (DWORD)0x00CC0020 // --------------------------------------------------------------------------- // GDI Structs // --------------------------------------------------------------------------- typedef struct tagBITMAPINFOHEADER { DWORD biSize; LONG biWidth; LONG biHeight; WORD biPlanes; WORD biBitCount; DWORD biCompression; DWORD biSizeImage; LONG biXPelsPerMeter; LONG biYPelsPerMeter; DWORD biClrUsed; DWORD biClrImportant; } BITMAPINFOHEADER; typedef struct tagRGBQUAD { unsigned char rgbBlue; unsigned char rgbGreen; unsigned char rgbRed; unsigned char rgbReserved; } RGBQUAD; typedef struct tagBITMAPINFO { BITMAPINFOHEADER bmiHeader; RGBQUAD bmiColors[1]; } BITMAPINFO; // --------------------------------------------------------------------------- // GDI Exports // --------------------------------------------------------------------------- __declspec(dllexport) int StretchDIBits( HDC hdc, int xDest, int yDest, int DestWidth, int DestHeight, int xSrc, int ySrc, int SrcWidth, int SrcHeight, const void *lpBits, const BITMAPINFO *lpbmi, UINT iUsage, DWORD rop) { (void)hdc; (void)xSrc; (void)ySrc; (void)SrcWidth; (void)SrcHeight; (void)lpbmi; (void)iUsage; (void)rop; // Direct mapping to kernel screen blit SysScreenBlit(xDest, yDest, DestWidth, DestHeight, (const uint32_t*)lpBits); // Return the number of scanlines copied return DestHeight; } __declspec(dllexport) BOOL BitBlt(HDC hdcDest, int xDest, int yDest, int w, int h, HDC hdcSrc, int xSrc, int ySrc, DWORD rop) { (void)hdcDest; (void)xDest; (void)yDest; (void)w; (void)h; (void)hdcSrc; (void)xSrc; (void)ySrc; (void)rop; // Stubbed. Applications manipulating pixels directly will use StretchDIBits. return TRUE; }