79 lines
2.0 KiB
C
79 lines
2.0 KiB
C
// Win32 GDI compatibility stubs. This file provides enough drawing API surface for simple applications.
|
|
|
|
#include <stdint.h>
|
|
#include <stddef.h>
|
|
#include <stdlib.h>
|
|
#include <ntlite/syscall.h>
|
|
|
|
#if defined(__SSE2__) || defined(_M_X64) || defined(_M_IX86)
|
|
#include <emmintrin.h>
|
|
#elif defined(__ARM_NEON) || defined(__ARM_NEON__) || defined(_M_ARM64)
|
|
#include <arm_neon.h>
|
|
#endif
|
|
|
|
// 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.
|
|
|
|
// Static buffers to persist between function calls.
|
|
static uint32_t* destBuffer = NULL;
|
|
static int* srcX_map = NULL;
|
|
static int currentDestCapacity = 0;
|
|
static int currentXMapCapacity = 0;
|
|
|
|
__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)xDest; (void)yDest; (void)DestWidth; (void)DestHeight;
|
|
(void)xSrc; (void)ySrc; (void)SrcWidth; (void)SrcHeight;
|
|
(void)lpBits; (void)lpbmi; (void)iUsage; (void)rop;
|
|
|
|
// There is no implicit display blit ABI. Native graphics clients own a
|
|
// surface and present it explicitly.
|
|
return 0;
|
|
}
|