From 14b6a6636b70795feaa3a6f941797061a03cc41e Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 9 Jul 2015 18:39:40 +0200 Subject: [PATCH] Create menu_video.c --- Makefile.common | 1 + griffin/griffin.c | 1 + menu/drivers/glui.c | 9 +++-- menu/drivers/rgui.c | 4 +- menu/drivers/rmenu.c | 4 +- menu/drivers/rmenu_xui.cpp | 3 +- menu/drivers/xmb.c | 15 ++++---- menu/{drivers/shared.h => menu_video.c} | 21 ++++------ menu/menu_video.h | 51 +++++++++++++++++++++++++ 9 files changed, 78 insertions(+), 31 deletions(-) rename menu/{drivers/shared.h => menu_video.c} (91%) create mode 100644 menu/menu_video.h diff --git a/Makefile.common b/Makefile.common index 2925a8a3a6..b58b09438d 100644 --- a/Makefile.common +++ b/Makefile.common @@ -408,6 +408,7 @@ ifeq ($(HAVE_MENU_COMMON), 1) menu/menu_navigation.o \ menu/menu_setting.o \ menu/menu_shader.o \ + menu/menu_video.o \ menu/menu_cbs.o \ menu/cbs/menu_cbs_ok.o \ menu/cbs/menu_cbs_cancel.o \ diff --git a/griffin/griffin.c b/griffin/griffin.c index a457489f1b..7b78ff8da2 100644 --- a/griffin/griffin.c +++ b/griffin/griffin.c @@ -747,6 +747,7 @@ MENU #include "../menu/menu_setting.c" #include "../menu/menu_list.c" #include "../menu/menu_cbs.c" +#include "../menu/menu_video.c" #include "../menu/cbs/menu_cbs_ok.c" #include "../menu/cbs/menu_cbs_cancel.c" #include "../menu/cbs/menu_cbs_select.c" diff --git a/menu/drivers/glui.c b/menu/drivers/glui.c index 0c460b8cb0..dd9b14330c 100644 --- a/menu/drivers/glui.c +++ b/menu/drivers/glui.c @@ -27,15 +27,16 @@ #include "../menu.h" #include "../menu_driver.h" +#include "../menu_hash.h" #include "../menu_entry.h" #include "../menu_display.h" -#include "../../runloop_data.h" +#include "../menu_video.h" #include "../../gfx/video_thread_wrapper.h" #include "../../gfx/font_driver.h" #include "../../gfx/video_texture.h" -#include "shared.h" +#include "../../runloop_data.h" typedef struct glui_handle { @@ -139,7 +140,7 @@ static void glui_render_quad(gl_t *gl, int x, int y, int w, int h, coords.color = color; - menu_gl_draw_frame(gl->shader, &coords, + menu_video_draw_frame(gl->shader, &coords, &gl->mvp_no_rot, true, glui->textures.white); gl->coords.color = gl->white_color_ptr; @@ -405,7 +406,7 @@ static void glui_frame(void) menu_display_set_viewport(); - gl_menu_frame_background(menu, settings, + menu_video_frame_background(menu, settings, gl, glui->textures.bg.id, 0.75f, 0.75f, false); menu_entries_get_title(title, sizeof(title)); diff --git a/menu/drivers/rgui.c b/menu/drivers/rgui.c index 01f0464977..6b707d2105 100644 --- a/menu/drivers/rgui.c +++ b/menu/drivers/rgui.c @@ -29,14 +29,14 @@ #include "../menu.h" #include "../menu_animation.h" #include "../menu_entry.h" +#include "../menu_hash.h" #include "../menu_display.h" +#include "../menu_video.h" #include "../../configuration.h" #include "../../runloop.h" #include "../../gfx/drivers_font_renderer/bitmap.h" -#include "shared.h" - #define RGUI_TERM_START_X (frame_buf->width / 21) #define RGUI_TERM_START_Y (frame_buf->height / 9) #define RGUI_TERM_WIDTH (((frame_buf->width - RGUI_TERM_START_X - RGUI_TERM_START_X) / (FONT_WIDTH_STRIDE))) diff --git a/menu/drivers/rmenu.c b/menu/drivers/rmenu.c index c5a42e71f4..6d2cfd2482 100644 --- a/menu/drivers/rmenu.c +++ b/menu/drivers/rmenu.c @@ -24,11 +24,12 @@ #include #include +#include "../menu.h" #include "../menu_driver.h" #include "../menu_entry.h" #include "../menu_input.h" #include "../menu_setting.h" -#include "../menu.h" +#include "../menu_video.h" #include "../../general.h" #include "../../config.def.h" #include "../../performance.h" @@ -36,7 +37,6 @@ #include "../../screenshot.h" #include "../../gfx/drivers_font_renderer/bitmap.h" -#include "shared.h" #if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_HLSL) #define HAVE_SHADER_MANAGER diff --git a/menu/drivers/rmenu_xui.cpp b/menu/drivers/rmenu_xui.cpp index c1c1638fce..31fb400100 100644 --- a/menu/drivers/rmenu_xui.cpp +++ b/menu/drivers/rmenu_xui.cpp @@ -33,6 +33,7 @@ #include "../menu_list.h" #include "../menu_input.h" #include "../menu_setting.h" +#include "../menu_video.h" #include "../../gfx/video_context_driver.h" @@ -40,8 +41,6 @@ #include "../../gfx/d3d/d3d.h" -#include "shared.h" - #define XUI_CONTROL_NAVIGATE_OK (XUI_CONTROL_NAVIGATE_RIGHT + 1) #define FONT_WIDTH 5 diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 34b1fe5be8..aee4ff7393 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -31,6 +31,7 @@ #include "../menu_animation.h" #include "../menu_display.h" #include "../menu_hash.h" +#include "../menu_video.h" #include "../menu_cbs.h" @@ -39,8 +40,6 @@ #include "../../runloop_data.h" -#include "shared.h" - #ifndef XMB_THEME #define XMB_THEME "monochrome" #endif @@ -394,7 +393,7 @@ static void xmb_draw_icon(gl_t *gl, xmb_handle_t *xmb, matrix_4x4_scale(&mscal, scale_factor, scale_factor, 1); matrix_4x4_multiply(&mymat, &mscal, &mymat); - menu_gl_draw_frame(gl->shader, &coords, &mymat, false, texture); + menu_video_draw_frame(gl->shader, &coords, &mymat, false, texture); } static void xmb_draw_icon_predone(gl_t *gl, xmb_handle_t *xmb, @@ -449,7 +448,7 @@ static void xmb_draw_icon_predone(gl_t *gl, xmb_handle_t *xmb, coords.lut_tex_coord = rmb_tex_coord; coords.color = color; - menu_gl_draw_frame(gl->shader, &coords, mymat, false, texture); + menu_video_draw_frame(gl->shader, &coords, mymat, false, texture); } static void xmb_draw_boxart(gl_t *gl, xmb_handle_t *xmb) @@ -498,7 +497,7 @@ static void xmb_draw_boxart(gl_t *gl, xmb_handle_t *xmb) matrix_4x4_scale(&mscal, 1, 1, 1); matrix_4x4_multiply(&mymat, &mscal, &mymat); - menu_gl_draw_frame(gl->shader, &coords, &mymat, false, xmb->boxart); + menu_video_draw_frame(gl->shader, &coords, &mymat, false, xmb->boxart); } static void xmb_draw_text(menu_handle_t *menu, @@ -1472,7 +1471,7 @@ static void xmb_draw_cursor(gl_t *gl, xmb_handle_t *xmb, float x, float y) xmb_draw_icon_begin(gl); - menu_gl_draw_frame(gl->shader, &coords, &mymat, true, xmb->textures.list[XMB_TEXTURE_POINTER].id); + menu_video_draw_frame(gl->shader, &coords, &mymat, true, xmb->textures.list[XMB_TEXTURE_POINTER].id); } static void xmb_render(void) @@ -1602,7 +1601,7 @@ static void xmb_frame(void) xmb->raster_block.carr.coords.vertices = 0; - gl_menu_frame_background(menu, settings, + menu_video_frame_background(menu, settings, gl, xmb->textures.bg.id, xmb->alpha, 0.75f, false); xmb_draw_text(menu, xmb, @@ -1688,7 +1687,7 @@ static void xmb_frame(void) if (render_background) { - gl_menu_frame_background(menu, settings, gl, + menu_video_frame_background(menu, settings, gl, xmb->textures.bg.id, xmb->alpha, 0.75f, true); xmb_frame_messagebox(msg); } diff --git a/menu/drivers/shared.h b/menu/menu_video.c similarity index 91% rename from menu/drivers/shared.h rename to menu/menu_video.c index 128f70be37..b3861561b8 100644 --- a/menu/drivers/shared.h +++ b/menu/menu_video.c @@ -13,18 +13,15 @@ * If not, see . */ -#ifndef _DISP_SHARED_H -#define _DISP_SHARED_H +#include -#include "../menu_setting.h" - -#include "../menu_display.h" -#include "../menu_cbs.h" +#include "menu_display.h" +#include "menu_hash.h" +#include "menu_setting.h" +#include "menu_video.h" #ifdef HAVE_OPENGL -#include "../../gfx/drivers/gl_common.h" - -static INLINE void menu_gl_draw_frame( +void menu_video_draw_frame( const shader_backend_t *shader, struct gl_coords *coords, math_matrix_4x4 *mat, @@ -48,7 +45,7 @@ static INLINE void menu_gl_draw_frame( glDisable(GL_BLEND); } -static INLINE void gl_menu_frame_background( +void menu_video_frame_background( menu_handle_t *menu, settings_t *settings, gl_t *gl, @@ -135,11 +132,9 @@ static INLINE void gl_menu_frame_background( && texture) coords.color = color; - menu_gl_draw_frame(gl->shader, &coords, + menu_video_draw_frame(gl->shader, &coords, &gl->mvp_no_rot, true, texture); gl->coords.color = gl->white_color_ptr; } #endif - -#endif diff --git a/menu/menu_video.h b/menu/menu_video.h new file mode 100644 index 0000000000..dbae57518c --- /dev/null +++ b/menu/menu_video.h @@ -0,0 +1,51 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2010-2014 - Hans-Kristian Arntzen + * Copyright (C) 2011-2015 - Daniel De Matteis + * + * RetroArch is free software: you can redistribute it and/or modify it under the terms + * of the GNU General Public License as published by the Free Software Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with RetroArch. + * If not, see . + */ + +#ifndef _MENU_VIDEO_H +#define _MENU_VIDEO_H + +#include "menu_shader.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef HAVE_OPENGL +#include "../gfx/drivers/gl_common.h" + +void menu_video_draw_frame( + const shader_backend_t *shader, + struct gl_coords *coords, + math_matrix_4x4 *mat, + bool blend, + GLuint texture + ); + +void menu_video_frame_background( + menu_handle_t *menu, + settings_t *settings, + gl_t *gl, + GLuint texture, + float handle_alpha, + float alpha, + bool force_transparency); +#endif + +#ifdef __cplusplus +} +#endif + +#endif