This commit is contained in:
twinaphex 2020-09-23 22:14:30 +02:00
parent 4fb2065061
commit c040e4cd08
8 changed files with 127 additions and 79 deletions

View File

@ -699,18 +699,6 @@ font_data_t *gfx_display_font_file(
return font_data;
}
void gfx_display_draw(gfx_display_ctx_draw_t *draw,
void *data,
unsigned video_width,
unsigned video_height)
{
gfx_display_t *p_disp = disp_get_ptr();
gfx_display_ctx_driver_t *dispctx = p_disp->dispctx;
if (draw && draw->height > 0 && draw->width > 0)
if (dispctx && dispctx->draw)
dispctx->draw(draw, data, video_width, video_height);
}
void gfx_display_draw_bg(gfx_display_ctx_draw_t *draw,
void *userdata, bool add_opacity_to_wallpaper,
float override_opacity)

View File

@ -269,11 +269,6 @@ bool gfx_display_init_first_driver(bool video_is_threaded);
gfx_display_t *disp_get_ptr(void);
void gfx_display_draw(gfx_display_ctx_draw_t *draw,
void *data,
unsigned video_width,
unsigned video_height);
void gfx_display_draw_keyboard(
void *userdata,
unsigned video_width,

View File

@ -867,8 +867,9 @@ void gfx_thumbnail_draw(
draw.y = shadow_y;
/* Draw shadow */
gfx_display_draw(&draw, userdata,
video_width, video_height);
if (draw.height > 0 && draw.width > 0)
if (dispctx && dispctx->draw)
dispctx->draw(&draw, userdata, video_width, video_height);
}
}
@ -880,9 +881,13 @@ void gfx_thumbnail_draw(
draw.y = draw_y;
/* Draw thumbnail */
gfx_display_draw(&draw, userdata,
video_width, video_height);
if (dispctx && dispctx->blend_end)
if (dispctx)
{
if (dispctx->draw)
if (draw.height > 0 && draw.width > 0)
dispctx->draw(&draw, userdata, video_width, video_height);
if (dispctx->blend_end)
dispctx->blend_end(userdata);
}
}
}

View File

@ -610,6 +610,8 @@ void gfx_widgets_draw_icon(
gfx_display_ctx_draw_t draw;
struct video_coords coords;
math_matrix_4x4 mymat;
gfx_display_t *p_disp = disp_get_ptr();
gfx_display_ctx_driver_t *dispctx = p_disp->dispctx;
if (!texture)
return;
@ -641,8 +643,9 @@ void gfx_widgets_draw_icon(
draw.prim_type = GFX_DISPLAY_PRIM_TRIANGLESTRIP;
draw.pipeline_id = 0;
gfx_display_draw(&draw, userdata,
video_width, video_height);
if (draw.height > 0 && draw.width > 0)
if (dispctx->draw)
dispctx->draw(&draw, userdata, video_width, video_height);
}
#ifdef HAVE_TRANSLATE
@ -694,13 +697,17 @@ static void gfx_widgets_draw_icon_blend(
draw.prim_type = GFX_DISPLAY_PRIM_TRIANGLESTRIP;
draw.pipeline_id = 0;
if (dispctx && dispctx->blend_begin)
if (dispctx)
{
if (dispctx->blend_begin)
dispctx->blend_begin(userdata);
gfx_display_draw(&draw, userdata,
video_width, video_height);
if (dispctx && dispctx->blend_end)
if (draw.height > 0 && draw.width > 0)
if (dispctx->draw)
dispctx->draw(&draw, userdata, video_width, video_height);
if (dispctx->blend_end)
dispctx->blend_end(userdata);
}
}
#endif
void gfx_widgets_draw_text(

View File

@ -2347,11 +2347,15 @@ static void materialui_draw_icon(
draw.prim_type = GFX_DISPLAY_PRIM_TRIANGLESTRIP;
draw.pipeline_id = 0;
gfx_display_draw(&draw, userdata,
video_width, video_height);
if (dispctx && dispctx->blend_end)
if (dispctx)
{
if (dispctx->draw)
if (draw.height > 0 && draw.width > 0)
dispctx->draw(&draw, userdata, video_width, video_height);
if (dispctx->blend_end)
dispctx->blend_end(userdata);
}
}
static void materialui_draw_thumbnail(
materialui_handle_t *mui,
@ -5052,15 +5056,19 @@ static void materialui_render_background(materialui_handle_t *mui,
}
/* Draw background */
if (dispctx && dispctx->blend_begin)
if (dispctx)
{
if (dispctx->blend_begin)
dispctx->blend_begin(userdata);
gfx_display_draw_bg(&draw, userdata,
add_opacity, opacity_override);
gfx_display_draw(&draw, userdata,
video_width, video_height);
if (dispctx && dispctx->blend_end)
if (dispctx->draw)
if (draw.height > 0 && draw.width > 0)
dispctx->draw(&draw, userdata, video_width, video_height);
if (dispctx->blend_end)
dispctx->blend_end(userdata);
}
}
static void materialui_render_landscape_border(
materialui_handle_t *mui,

View File

@ -277,6 +277,10 @@ void ozone_draw_icon(
gfx_display_ctx_draw_t draw;
struct video_coords coords;
math_matrix_4x4 mymat;
gfx_display_t
*p_disp = disp_get_ptr();
gfx_display_ctx_driver_t
*dispctx = p_disp->dispctx;
rotate_draw.matrix = &mymat;
rotate_draw.rotation = rotation;
@ -305,8 +309,9 @@ void ozone_draw_icon(
draw.prim_type = GFX_DISPLAY_PRIM_TRIANGLESTRIP;
draw.pipeline_id = 0;
gfx_display_draw(&draw, userdata,
video_width, video_height);
if (draw.height > 0 && draw.width > 0)
if (dispctx && dispctx->draw)
dispctx->draw(&draw, userdata, video_width, video_height);
}
void ozone_draw_backdrop(

View File

@ -620,8 +620,9 @@ static void stripes_draw_icon(
draw.y = draw.y + (icon_size-draw.width)/2;
}
#endif
gfx_display_draw(&draw, userdata,
video_width, video_height);
if (draw.height > 0 && draw.width > 0)
if (dispctx && dispctx->draw)
dispctx->draw(&draw, userdata, video_width, video_height);
}
coords.color = (const float*)color;
@ -635,8 +636,9 @@ static void stripes_draw_icon(
draw.y = draw.y + (icon_size-draw.width)/2;
}
#endif
gfx_display_draw(&draw, userdata,
video_width, video_height);
if (draw.height > 0 && draw.width > 0)
if (dispctx && dispctx->draw)
dispctx->draw(&draw, userdata, video_width, video_height);
}
static void stripes_draw_text(
@ -2786,13 +2788,17 @@ static void stripes_draw_bg(
draw.prim_type = GFX_DISPLAY_PRIM_TRIANGLESTRIP;
draw.pipeline_id = 0;
if (dispctx && dispctx->blend_begin)
if (dispctx)
{
if (dispctx->blend_begin)
dispctx->blend_begin(userdata);
gfx_display_draw(&draw, userdata,
video_width, video_height);
if (dispctx && dispctx->blend_end)
if (dispctx->draw)
if (draw.height > 0 && draw.width > 0)
dispctx->draw(&draw, userdata, video_width, video_height);
if (dispctx->blend_end)
dispctx->blend_end(userdata);
}
}
static void stripes_draw_dark_layer(
stripes_handle_t *stripes,
@ -2831,13 +2837,17 @@ static void stripes_draw_dark_layer(
draw.prim_type = GFX_DISPLAY_PRIM_TRIANGLESTRIP;
draw.pipeline_id = 0;
if (dispctx && dispctx->blend_begin)
if (dispctx)
{
if (dispctx->blend_begin)
dispctx->blend_begin(userdata);
gfx_display_draw(&draw, userdata,
video_width, video_height);
if (dispctx && dispctx->blend_end)
if (dispctx->draw)
if (draw.height > 0 && draw.width > 0)
dispctx->draw(&draw, userdata, video_width, video_height);
if (dispctx->blend_end)
dispctx->blend_end(userdata);
}
}
static void stripes_frame(void *data, video_frame_info_t *video_info)
{

View File

@ -809,6 +809,8 @@ static void *xmb_list_get_entry(void *data,
static void xmb_draw_icon(
void *userdata,
gfx_display_t *p_disp,
gfx_display_ctx_driver_t *dispctx,
unsigned video_width,
unsigned video_height,
bool xmb_shadows_enable,
@ -870,8 +872,9 @@ static void xmb_draw_icon(
draw.y = draw.y + (icon_size-draw.width)/2;
}
#endif
gfx_display_draw(&draw, userdata,
video_width, video_height);
if (draw.height > 0 && draw.width > 0)
if (dispctx && dispctx->draw)
dispctx->draw(&draw, userdata, video_width, video_height);
}
coords.color = (const float*)color;
@ -885,8 +888,9 @@ static void xmb_draw_icon(
draw.y = draw.y + (icon_size-draw.width)/2;
}
#endif
gfx_display_draw(&draw, userdata,
video_width, video_height);
if (draw.height > 0 && draw.width > 0)
if (dispctx && dispctx->draw)
dispctx->draw(&draw, userdata, video_width, video_height);
}
static void xmb_draw_text(
@ -3010,6 +3014,8 @@ static uintptr_t xmb_icon_get_id(xmb_handle_t *xmb,
static int xmb_draw_item(
void *userdata,
gfx_display_t *p_disp,
gfx_display_ctx_driver_t *dispctx,
unsigned video_width,
unsigned video_height,
bool xmb_shadows_enable,
@ -3406,6 +3412,8 @@ static int xmb_draw_item(
xmb_draw_icon(
userdata,
p_disp,
dispctx,
video_width,
video_height,
xmb_shadows_enable,
@ -3428,6 +3436,8 @@ static int xmb_draw_item(
if (texture_switch != 0 && color[3] != 0 && !xmb->assets_missing)
xmb_draw_icon(
userdata,
p_disp,
dispctx,
video_width,
video_height,
xmb_shadows_enable,
@ -3511,6 +3521,8 @@ static void xmb_draw_items(
{
if (xmb_draw_item(
userdata,
p_disp,
dispctx,
video_width,
video_height,
xmb_shadows_enable,
@ -4057,8 +4069,9 @@ static void xmb_draw_bg(
gfx_display_draw_bg(&draw, userdata, false,
menu_wallpaper_opacity);
gfx_display_draw(&draw, userdata,
video_width, video_height);
if (draw.height > 0 && draw.width > 0)
if (dispctx && dispctx->draw)
dispctx->draw(&draw, userdata, video_width, video_height);
draw.pipeline_id = VIDEO_SHADER_MENU_2;
@ -4108,8 +4121,9 @@ static void xmb_draw_bg(
gfx_display_draw_bg(&draw, userdata, false,
menu_wallpaper_opacity);
gfx_display_draw(&draw, userdata,
video_width, video_height);
if (draw.height > 0 && draw.width > 0)
if (dispctx && dispctx->draw)
dispctx->draw(&draw, userdata, video_width, video_height);
}
{
@ -4129,11 +4143,15 @@ static void xmb_draw_bg(
}
}
gfx_display_draw(&draw, userdata,
video_width, video_height);
if (dispctx && dispctx->blend_end)
if (dispctx)
{
if (dispctx->draw)
if (draw.height > 0 && draw.width > 0)
dispctx->draw(&draw, userdata, video_width, video_height);
if (dispctx->blend_end)
dispctx->blend_end(userdata);
}
}
static void xmb_draw_dark_layer(
xmb_handle_t *xmb,
@ -4170,13 +4188,17 @@ static void xmb_draw_dark_layer(
draw.prim_type = GFX_DISPLAY_PRIM_TRIANGLESTRIP;
draw.pipeline_id = 0;
if (dispctx && dispctx->blend_begin)
if (dispctx)
{
if (dispctx->blend_begin)
dispctx->blend_begin(userdata);
gfx_display_draw(&draw, userdata,
width, height);
if (dispctx && dispctx->blend_end)
if (draw.height > 0 && draw.width > 0)
if (dispctx && dispctx->draw)
dispctx->draw(&draw, userdata, width, height);
if (dispctx->blend_end)
dispctx->blend_end(userdata);
}
}
static void xmb_draw_fullscreen_thumbnails(
xmb_handle_t *xmb,
@ -4964,6 +4986,8 @@ static void xmb_frame(void *data, video_frame_info_t *video_info)
dispctx->blend_begin(userdata);
xmb_draw_icon(
userdata,
p_disp,
dispctx,
video_width,
video_height,
xmb_shadows_enable,
@ -5018,6 +5042,8 @@ static void xmb_frame(void *data, video_frame_info_t *video_info)
dispctx->blend_begin(userdata);
xmb_draw_icon(
userdata,
p_disp,
dispctx,
video_width,
video_height,
xmb_shadows_enable,
@ -5065,6 +5091,8 @@ static void xmb_frame(void *data, video_frame_info_t *video_info)
dispctx->blend_begin(userdata);
xmb_draw_icon(
userdata,
p_disp,
dispctx,
video_width,
video_height,
xmb_shadows_enable,
@ -5150,6 +5178,8 @@ static void xmb_frame(void *data, video_frame_info_t *video_info)
xmb_draw_icon(
userdata,
p_disp,
dispctx,
video_width,
video_height,
xmb_shadows_enable,