GDI: remove unused code and fix menu toggle in rgui and xmb

This commit is contained in:
Brad Parker 2017-01-16 17:37:19 -05:00
parent 493b7372bd
commit e4bdc5ce8b
2 changed files with 16 additions and 97 deletions

View File

@ -43,12 +43,6 @@ static void gdi_gfx_free(void *data);
static void gdi_gfx_create()
{
if(!gdi_video_width || !gdi_video_height)
{
printf("***** GDI: no width or height!\n");
}
//video_driver_set_size(&gdi_video_width, &gdi_video_height);
}
static void *gdi_gfx_init(const video_info_t *video,
@ -89,67 +83,6 @@ static void *gdi_gfx_init(const video_info_t *video,
RARCH_LOG("Found GDI context: %s\n", ctx_driver->ident);
/*#ifdef HAVE_WINDOW
win32_window_init(&gdi->wndclass, true, NULL);
#endif
#ifdef HAVE_MONITOR
bool windowed_full;
RECT mon_rect;
MONITORINFOEX current_mon;
HMONITOR hm_to_use;
win32_monitor_info(&current_mon, &hm_to_use, &d3d->cur_mon_id);
mon_rect = current_mon.rcMonitor;
g_resize_width = video->width;
g_resize_height = video->height;
windowed_full = settings->video.windowed_fullscreen;
full_x = (windowed_full || video->width == 0) ?
(mon_rect.right - mon_rect.left) : video->width;
full_y = (windowed_full || video->height == 0) ?
(mon_rect.bottom - mon_rect.top) : video->height;
RARCH_LOG("[GDI]: Monitor size: %dx%d.\n",
(int)(mon_rect.right - mon_rect.left),
(int)(mon_rect.bottom - mon_rect.top));
#else
{
video_context_driver_get_video_size(&mode);
full_x = mode.width;
full_y = mode.height;
}
#endif
{
unsigned new_width = video->fullscreen ? full_x : video->width;
unsigned new_height = video->fullscreen ? full_y : video->height;
mode.width = new_width;
mode.height = new_height;
mode.fullscreen = video->fullscreen;
video_context_driver_set_video_mode(&mode);
video_driver_set_size(&new_width, &new_height);
}
#ifdef HAVE_WINDOW
DWORD style;
unsigned win_width, win_height;
RECT rect = {0};
video_driver_get_size(&win_width, &win_height);
win32_set_style(&current_mon, &hm_to_use, &win_width, &win_height,
video->fullscreen, windowed_full, &rect, &mon_rect, &style);
win32_window_create(gdi, style, &mon_rect, win_width,
win_height, video->fullscreen);
win32_set_window(&win_width, &win_height, video->fullscreen,
windowed_full, &rect);
#endif
*/
video_context_driver_get_video_size(&mode);
full_x = mode.width;
@ -215,7 +148,7 @@ error:
static bool gdi_gfx_frame(void *data, const void *frame,
unsigned frame_width, unsigned frame_height, uint64_t frame_count,
unsigned pitch, const char *msg)
unsigned pitch, const char *msg, video_frame_info_t video_info)
{
const void *frame_to_copy = frame;
unsigned width = 0;
@ -241,12 +174,10 @@ static bool gdi_gfx_frame(void *data, const void *frame,
gdi_video_width = frame_width;
gdi_video_height = frame_height;
gdi_video_pitch = pitch;
//gdi_gfx_free(NULL);
//gdi_gfx_create();
}
}
if (gdi_menu_frame)
if (gdi_menu_frame && menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL))
{
frame_to_copy = gdi_menu_frame;
width = gdi_menu_width;
@ -262,13 +193,14 @@ static bool gdi_gfx_frame(void *data, const void *frame,
if (frame_width == 4 && frame_height == 4 && (frame_width < width && frame_height < height))
draw = false;
if (menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL))
draw = false;
}
GetClientRect(hwnd, &rect);
video_context_driver_get_video_size(&mode);
//printf("left %d top %d right %d bottom %d mode %d x %d size %d x %d pitch %d bits %d\n", rect.left, rect.top, rect.right, rect.bottom, mode.width, mode.height, width, height, pitch, bits);
if (draw)
{
HDC winDC = GetDC(hwnd);
@ -276,17 +208,9 @@ static bool gdi_gfx_frame(void *data, const void *frame,
HBITMAP bmp = CreateCompatibleBitmap(winDC, width, height);
HBITMAP bmp_old;
BITMAPINFO *info = (BITMAPINFO*)calloc(1, sizeof(*info) + (3 * sizeof(RGBQUAD)));
//HBRUSH brush;
int ret = 0;
bmp_old = (HBITMAP)SelectObject(memDC, bmp);
//brush = CreateSolidBrush(GetSysColor(COLOR_WINDOW));
//FillRect(memDC, &rect, brush);
//DeleteObject(brush);
info->bmiHeader.biBitCount = bits;
info->bmiHeader.biWidth = pitch / 2;
info->bmiHeader.biHeight = -height;
@ -308,18 +232,14 @@ static bool gdi_gfx_frame(void *data, const void *frame,
else
info->bmiHeader.biCompression = BI_RGB;
ret = StretchDIBits(memDC, 0, 0, width, height, 0, 0, width, height,
StretchDIBits(memDC, 0, 0, width, height, 0, 0, width, height,
frame_to_copy, info, DIB_RGB_COLORS, SRCCOPY);
//printf("StretchDIBits: %d\n", ret);
ret = StretchBlt(winDC,
StretchBlt(winDC,
0, 0,
mode.width, mode.height,
memDC, 0, 0, width, height, SRCCOPY);
//printf("BitBlt: %d\n", ret);
SelectObject(memDC, bmp_old);
DeleteObject(bmp);
@ -334,9 +254,7 @@ static bool gdi_gfx_frame(void *data, const void *frame,
InvalidateRect(hwnd, NULL, false);
video_context_driver_update_window_title();
//video_context_driver_swap_buffers();
video_context_driver_update_window_title(video_info);
return true;
}

View File

@ -87,19 +87,18 @@ static bool gfx_ctx_gdi_set_resize(void *data,
return false;
}
static void gfx_ctx_gdi_update_window_title(void *data)
static void gfx_ctx_gdi_update_window_title(void *data, video_frame_info_t video_info)
{
char buf[128];
char buf_fps[128];
settings_t *settings = config_get_ptr();
const ui_window_t *window = ui_companion_driver_get_window_ptr();
buf[0] = buf_fps[0] = '\0';
if (window && video_monitor_get_fps(buf, sizeof(buf),
if (window && video_monitor_get_fps(video_info, buf, sizeof(buf),
buf_fps, sizeof(buf_fps)))
window->set_title(&main_window, buf);
if (settings->fps_show)
if (video_info.fps_show)
runloop_msg_queue_push(buf_fps, 1, 1, false);
}
@ -128,7 +127,7 @@ static void gfx_ctx_gdi_get_video_size(void *data,
}
}
static void *gfx_ctx_gdi_init(void *video_driver)
static void *gfx_ctx_gdi_init(video_frame_info_t video_info, void *video_driver)
{
WNDCLASSEX wndclass = {0};
@ -191,6 +190,7 @@ static void gfx_ctx_gdi_destroy(void *data)
}
static bool gfx_ctx_gdi_set_video_mode(void *data,
video_frame_info_t video_info,
unsigned width, unsigned height,
bool fullscreen)
{
@ -216,11 +216,12 @@ error:
static void gfx_ctx_gdi_input_driver(void *data,
const char *joypad_name,
const input_driver_t **input, void **input_data)
{
(void)data;
dinput_gdi = input_dinput.init();
dinput_gdi = input_dinput.init(joypad_name);
*input = dinput_gdi ? &input_dinput : NULL;
*input_data = dinput_gdi;
@ -286,7 +287,7 @@ static uint32_t gfx_ctx_gdi_get_flags(void *data)
return flags;
}
static void gfx_ctx_gdi_swap_buffers(void *data)
static void gfx_ctx_gdi_swap_buffers(void *data, video_frame_info_t video_info)
{
(void)data;