Create menu_display_set_viewport

This commit is contained in:
twinaphex 2015-04-26 16:46:56 +02:00
parent 15dd8e71ac
commit d3dba0edc2
7 changed files with 57 additions and 12 deletions

View File

@ -38,6 +38,8 @@
#endif
#endif
#include "d3d_defines.h"
#ifdef _XBOX1
#include <xfont.h>
#endif

View File

@ -238,6 +238,14 @@ static const video_driver_t *video_driver_ctx_get_ptr(void)
return driver->video;
}
const char *video_driver_get_ident(void)
{
const video_driver_t *video = video_driver_ctx_get_ptr();
if (video)
return video->ident;
return NULL;
}
/**
* video_driver_get_current_framebuffer:
*

View File

@ -331,6 +331,8 @@ bool video_driver_frame(const void *frame, unsigned width,
bool video_driver_suppress_screensaver(bool enable);
const char *video_driver_get_ident(void);
#ifdef __cplusplus
}
#endif

View File

@ -465,7 +465,7 @@ static void glui_frame(void)
&& !menu->msg_force)
return;
gl_set_viewport(gl, global->video_data.width, global->video_data.height, true, false);
menu_display_set_viewport(menu);
glui_render_background(settings, gl, glui);

View File

@ -438,15 +438,7 @@ static void rmenu_xui_frame(void)
if (!d3dr)
return;
(void)menu;
vp_full.X = 0;
vp_full.Y = 0;
vp_full.Width = global->video_data.width;
vp_full.Height = global->video_data.height;
vp_full.MinZ = 0.0f;
vp_full.MaxZ = 1.0f;
d3d_set_viewport(d3dr, &vp_full);
menu_display_set_viewport(menu);
app.RunFrame();
XuiTimersRun();

View File

@ -1321,8 +1321,7 @@ static void xmb_frame(void)
if (!gl)
return;
gl_set_viewport(gl, global->video_data.width,
global->video_data.height, true, false);
menu_display_set_viewport(menu);
menu_display_font_bind_block(menu, font_driver, &xmb->raster_block);

View File

@ -17,10 +17,15 @@
#include "menu_display.h"
#include "menu_animation.h"
#include "../dynamic.h"
#include "../../gfx/drivers/gl_common.h"
#include "../../retroarch.h"
#include "../../config.def.h"
#include "../gfx/video_context_driver.h"
#ifdef HAVE_D3D
#include "../gfx/d3d/d3d.h"
#endif
bool menu_display_update_pending(void)
{
runloop_t *runloop = rarch_main_get_ptr();
@ -155,3 +160,40 @@ bool menu_display_font_flush_block(menu_handle_t *menu,
return menu_display_font_bind_block(menu,
font_driver, NULL);
}
void menu_display_set_viewport(menu_handle_t *menu)
{
global_t *global = global_get_ptr();
driver_t *driver = driver_get_ptr();
const char *ident = video_driver_get_ident();
#ifdef HAVE_OPENGL
if (!strcmp(ident, "gl"))
{
gl_set_viewport(driver->video_data,
global->video_data.width,
global->video_data.height, true, false);
return;
}
#endif
#ifdef HAVE_D3D
if (!strcmp(ident, "d3d"))
{
D3DVIEWPORT vp_full;
LPDIRECT3DDEVICE d3dr;
d3d_video_t *d3d = (d3d_video_t*)driver->video_data;
vp_full.X = 0;
vp_full.Y = 0;
vp_full.Width = global->video_data.width;
vp_full.Height = global->video_data.height;
vp_full.MinZ = 0.0f;
vp_full.MaxZ = 1.0f;
d3dr = (LPDIRECT3DDEVICE)d3d->dev;
d3d_set_viewport(d3dr, &vp_full);
return;
}
#endif
}