move menu_display_get_size to gfx/video_driver.c and rename

it video_driver_get_size
This commit is contained in:
twinaphex 2015-05-20 00:29:46 +02:00
parent c183f9dd11
commit d64655c11b
6 changed files with 29 additions and 29 deletions

View File

@ -837,3 +837,12 @@ bool video_driver_frame(const void *frame, unsigned width,
return true;
return false;
}
void video_driver_get_size(unsigned *width, unsigned *height)
{
global_t *global = global_get_ptr();
if (width)
*width = global->video_data.width;
if (height)
*height = global->video_data.height;
}

View File

@ -340,6 +340,8 @@ const char *video_driver_get_ident(void);
bool video_driver_set_viewport(unsigned width, unsigned height,
bool force_fullscreen, bool allow_rotate);
void video_driver_get_size(unsigned *width, unsigned *height);
uint64_t video_driver_get_frame_count(void);
#ifdef __cplusplus

View File

@ -65,7 +65,7 @@ static void glui_blit_line(float x, float y,
if (!menu)
return;
menu_display_get_size(&width, &height);
video_driver_get_size(&width, &height);
glui = (glui_handle_t*)menu->userdata;
@ -110,7 +110,7 @@ static void glui_render_quad(gl_t *gl, int x, int y, int w, int h,
r, g, b, a,
};
menu_display_get_size(&width, &height);
video_driver_get_size(&width, &height);
glViewport(x, height - y - h, w, h);
@ -142,7 +142,7 @@ static void glui_draw_scrollbar(gl_t *gl)
if (!menu)
return;
menu_display_get_size(&width, &height);
video_driver_get_size(&width, &height);
glui = (glui_handle_t*)menu->userdata;
content_height = menu_entries_get_end() * glui->line_height;
@ -199,7 +199,7 @@ static void glui_render_messagebox(const char *message)
if (list->elems == 0)
goto end;
menu_display_get_size(&width, &height);
video_driver_get_size(&width, &height);
x = width / 2;
y = height / 2 - list->size * menu->font.size / 2;
@ -228,7 +228,7 @@ static void glui_render(void)
if (!menu || !menu->userdata)
return;
menu_display_get_size(&width, &height);
video_driver_get_size(&width, &height);
glui = (glui_handle_t*)menu->userdata;
@ -286,7 +286,7 @@ static void glui_render_menu_list(runloop_t *runloop,
if (!menu_display_update_pending())
return;
menu_display_get_size(&width, &height);
video_driver_get_size(&width, &height);
glui->list_block.carr.coords.vertices = 0;
@ -354,7 +354,7 @@ static void glui_frame(void)
&& !glui->box_message[0])
return;
menu_display_get_size(&width, &height);
video_driver_get_size(&width, &height);
menu_display_set_viewport();
@ -587,7 +587,7 @@ static float glui_get_scroll(void)
if (!menu || !menu->userdata)
return 0;
menu_display_get_size(&width, &height);
video_driver_get_size(&width, &height);
glui = (glui_handle_t*)menu->userdata;
half = (height / glui->line_height) / 2;

View File

@ -273,7 +273,7 @@ static void xmb_draw_icon(gl_t *gl, xmb_handle_t *xmb,
if (alpha == 0)
return;
menu_display_get_size(&width, &height);
video_driver_get_size(&width, &height);
if (
x < -xmb->icon.size/2 ||
@ -320,7 +320,7 @@ static void xmb_draw_icon_predone(gl_t *gl, xmb_handle_t *xmb,
if (alpha == 0)
return;
menu_display_get_size(&width, &height);
video_driver_get_size(&width, &height);
if (
x < -xmb->icon.size/2 ||
@ -368,7 +368,7 @@ static void xmb_draw_text(menu_handle_t *menu,
if (a8 == 0)
return;
menu_display_get_size(&width, &height);
video_driver_get_size(&width, &height);
if (x < -xmb->icon.size || x > width + xmb->icon.size
|| y < -xmb->icon.size || y > height + xmb->icon.size)
@ -414,7 +414,7 @@ static void xmb_frame_messagebox(const char *message)
if (!menu)
return;
menu_display_get_size(&width, &height);
video_driver_get_size(&width, &height);
xmb = (xmb_handle_t*)menu->userdata;
@ -963,7 +963,7 @@ static void xmb_draw_items(xmb_handle_t *xmb, gl_t *gl,
if (!list || !list->size)
return;
menu_display_get_size(&width, &height);
video_driver_get_size(&width, &height);
file_list_get_last(stack, NULL, &label, NULL);
@ -1106,7 +1106,7 @@ static void xmb_draw_cursor(gl_t *gl, xmb_handle_t *xmb, float x, float y)
1.0f, 1.0f, 1.0f, xmb->alpha,
};
menu_display_get_size(&width, &height);
video_driver_get_size(&width, &height);
glViewport(x, height - y, xmb->cursor.size, xmb->cursor.size);
@ -1198,7 +1198,7 @@ static void xmb_frame(void)
if (!gl)
return;
menu_display_get_size(&width, &height);
video_driver_get_size(&width, &height);
menu_display_font_bind_block(menu, font_driver, &xmb->raster_block);
@ -1339,7 +1339,7 @@ static void *xmb_init(void)
if (!menu)
goto error;
menu_display_get_size(&width, &height);
video_driver_get_size(&width, &height);
menu->userdata = (xmb_handle_t*)calloc(1, sizeof(xmb_handle_t));

View File

@ -219,19 +219,10 @@ bool menu_display_init_main_font(menu_handle_t *menu,
return result;
}
void menu_display_get_size(unsigned *width, unsigned *height)
{
global_t *global = global_get_ptr();
if (width)
*width = global->video_data.width;
if (height)
*height = global->video_data.height;
}
void menu_display_set_viewport(void)
{
unsigned width, height;
menu_display_get_size(&width, &height);
video_driver_get_size(&width, &height);
video_driver_set_viewport(width, height, true, false);
}
@ -239,7 +230,7 @@ void menu_display_set_viewport(void)
void menu_display_unset_viewport(void)
{
unsigned width, height;
menu_display_get_size(&width, &height);
video_driver_get_size(&width, &height);
video_driver_set_viewport(width,
height, false, true);

View File

@ -56,8 +56,6 @@ bool menu_display_init_main_font(menu_handle_t *menu,
const char *font_path, float font_size);
void menu_display_free_main_font(menu_handle_t *menu);
void menu_display_get_size(unsigned *width, unsigned *height);
void menu_display_set_viewport(void);
void menu_display_unset_viewport(void);