6 #define SCREENLIST(w, h) ((h) | (w) << 16)
8 #define LWA_COLORKEY 0x00000001
11 static int driver_init(
char *title,
int w,
int h,
int depth,
int refresh_rate,
int flags);
46 s = (
unsigned int *)src;
47 d = (
unsigned int *)dest;
60 unsigned char *source;
71 SetDIBitsToDevice(hdc, 0, 0,
fb_win32.
w,
fb_win32.
h, 0, 0, 0,
fb_win32.
h, source,
bitmap_info, DIB_RGB_COLORS);
79 DWORD style, ex_style = 0;
84 MONITORINFOEX monitor_info;
85 const char *devname =
NULL;
91 monitor_info.cbSize =
sizeof(MONITORINFOEX);
92 monitor_info.szDevice[0] =
'\0';
95 devname = monitor_info.szDevice;
100 mode.dmSize =
sizeof(mode);
105 mode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL | DM_DISPLAYFREQUENCY;
110 }
else if (ChangeDisplaySettings(&mode, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL) {
114 style = WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN;
116 style = WS_OVERLAPPEDWINDOW & ~WS_THICKFRAME;
118 style &= ~WS_MAXIMIZEBOX;
124 ex_style = WS_EX_LAYERED;
128 rect.left = rect.top = x = y = 0;
133 AdjustWindowRect(&rect, style, 0);
134 rect.right -= rect.left;
135 rect.bottom -= rect.top;
136 if (monitor_info.szDevice[0]) {
137 x = monitor_info.rcMonitor.left + ((monitor_info.rcMonitor.right - monitor_info.rcMonitor.left - rect.right) >> 1);
138 y = monitor_info.rcMonitor.top + ((monitor_info.rcMonitor.bottom - monitor_info.rcMonitor.top - rect.bottom) >> 1);
140 x = (GetSystemMetrics(SM_CXSCREEN) - rect.right) >> 1;
141 y = (GetSystemMetrics(SM_CYSCREEN) - rect.bottom) >> 1;
143 }
else if (monitor_info.szDevice[0]) {
145 x = monitor_info.rcMonitor.left;
146 y = monitor_info.rcMonitor.top;
149 if (
fb_hInitWindow(style | WS_VISIBLE, ex_style, x, y, rect.right, rect.bottom))
157 bitmap_info = (BITMAPINFO *)calloc(1,
sizeof(BITMAPINFO) + (
sizeof(RGBQUAD) * 256));
160 bitmap_info->bmiHeader.biSize =
sizeof(BITMAPINFOHEADER);
192 lp = (LOGPALETTE *)malloc(
sizeof(LOGPALETTE) + (
sizeof(PALETTEENTRY) * 256));
193 lp->palNumEntries = 256;
194 lp->palVersion = 0x300;
212 ChangeDisplaySettings(
NULL, 0);
220 static unsigned int WINAPI
gdi_thread(
void *param )
225 HANDLE running_event = param;
227 unsigned char *source, keystate[256];
233 SetEvent(running_event);
246 for (i = 0; i < 256; i++) {
272 SetDIBitsToDevice(hdc, 0, y1,
fb_win32.
w, h, 0, 0, 0, h, source,
bitmap_info, DIB_RGB_COLORS);
288 GetKeyboardState(keystate);
308 static int driver_init(
char *title,
int w,
int h,
int depth,
int refresh_rate,
int flags)
324 int *data =
NULL, *newdata;
329 while (EnumDisplaySettings(
NULL, mode, &dm)) {
330 if ((dm.dmBitsPerPel == depth) ||
331 (dm.dmBitsPerPel == 15 && depth == 16) ||
332 (dm.dmBitsPerPel == 16 && depth == 15) ||
333 (dm.dmBitsPerPel == 24 && depth == 32) ||
334 (dm.dmBitsPerPel == 32 && depth == 24)) {
336 newdata = realloc(data, count *
sizeof(
int));
342 data[count - 1] =
SCREENLIST(dm.dmPelsWidth, dm.dmPelsHeight);