From 044619281ca0ac4cfbe415dd0f4c2e4dba3b3e04 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 8 Mar 2020 22:52:02 +0100 Subject: [PATCH] gfx_display_draw - remove video_frame_info dependency --- gfx/gfx_display.c | 69 +++++++++++++++++++----------- gfx/gfx_display.h | 19 +++++--- gfx/gfx_thumbnail.c | 6 ++- gfx/gfx_widgets.c | 6 ++- menu/drivers/materialui.c | 6 ++- menu/drivers/ozone/ozone_display.c | 3 +- menu/drivers/stripes.c | 12 ++++-- menu/drivers/xmb.c | 12 ++++-- 8 files changed, 87 insertions(+), 46 deletions(-) diff --git a/gfx/gfx_display.c b/gfx/gfx_display.c index c01a6c0b7c..13f0f0396f 100644 --- a/gfx/gfx_display.c +++ b/gfx/gfx_display.c @@ -724,15 +724,17 @@ bool gfx_display_restore_clear_color(void) return true; } -void gfx_display_clear_color(gfx_display_ctx_clearcolor_t *color, - video_frame_info_t *video_info) +/* TODO/FIXME - this is no longer used - consider getting rid of it */ +void gfx_display_clear_color(gfx_display_ctx_clearcolor_t *color, void *data) { if (dispctx && dispctx->clear_color) - dispctx->clear_color(color, video_info->userdata); + dispctx->clear_color(color, data); } void gfx_display_draw(gfx_display_ctx_draw_t *draw, - video_frame_info_t *video_info) + void *data, + unsigned video_width, + unsigned video_height) { if (!dispctx || !draw || !dispctx->draw) return; @@ -741,12 +743,14 @@ void gfx_display_draw(gfx_display_ctx_draw_t *draw, return; if (draw->width <= 0) return; - dispctx->draw(draw, video_info->userdata, - video_info->width, video_info->height); + dispctx->draw(draw, data, video_width, video_height); } -void gfx_display_draw_blend(gfx_display_ctx_draw_t *draw, - video_frame_info_t *video_info) +void gfx_display_draw_blend( + gfx_display_ctx_draw_t *draw, + void *data, + unsigned video_width, + unsigned video_height) { if (!dispctx || !draw || !dispctx->draw) return; @@ -755,10 +759,9 @@ void gfx_display_draw_blend(gfx_display_ctx_draw_t *draw, return; if (draw->width <= 0) return; - gfx_display_blend_begin(video_info->userdata); - dispctx->draw(draw, video_info->userdata, - video_info->width, video_info->height); - gfx_display_blend_end(video_info->userdata); + gfx_display_blend_begin(data); + dispctx->draw(draw, data, video_width, video_height); + gfx_display_blend_end(data); } void gfx_display_draw_pipeline(gfx_display_ctx_draw_t *draw, @@ -820,7 +823,8 @@ void gfx_display_draw_gradient(gfx_display_ctx_draw_t *draw, gfx_display_draw_bg(draw, video_info, false, video_info->menu_wallpaper_opacity); - gfx_display_draw(draw, video_info); + gfx_display_draw(draw, video_info->userdata, + video_info->width, video_info->height); } void gfx_display_draw_quad( @@ -853,7 +857,8 @@ void gfx_display_draw_quad( draw.scale_factor = 1.0f; draw.rotation = 0.0f; - gfx_display_draw(&draw, video_info); + gfx_display_draw(&draw, video_info->userdata, + video_info->width, video_info->height); if (dispctx && dispctx->blend_end) dispctx->blend_end(video_info->userdata); @@ -903,7 +908,8 @@ void gfx_display_draw_polygon( draw.scale_factor = 1.0f; draw.rotation = 0.0f; - gfx_display_draw(&draw, video_info); + gfx_display_draw(&draw, video_info->userdata, + video_info->width, video_info->height); if (dispctx && dispctx->blend_end) dispctx->blend_end(video_info->userdata); @@ -942,7 +948,8 @@ void gfx_display_draw_texture( draw.texture = texture; draw.x = x; draw.y = height - y; - gfx_display_draw(&draw, video_info); + gfx_display_draw(&draw, video_info->userdata, + video_info->width, video_info->height); } /* Draw the texture split into 9 sections, without scaling the corners. @@ -1058,7 +1065,8 @@ void gfx_display_draw_texture_slice( tex_coord[6] = T_TR[0]; tex_coord[7] = T_TR[1]; - gfx_display_draw(&draw, video_info); + gfx_display_draw(&draw, video_info->userdata, + video_info->width, video_info->height); /* top-middle section */ vert_coord[0] = V_BL[0] + vert_woff; @@ -1079,7 +1087,8 @@ void gfx_display_draw_texture_slice( tex_coord[6] = T_TR[0] + tex_mid_width; tex_coord[7] = T_TR[1]; - gfx_display_draw(&draw, video_info); + gfx_display_draw(&draw, video_info->userdata, + video_info->width, video_info->height); /* top-right corner */ vert_coord[0] = V_BL[0] + vert_woff + vert_scaled_mid_width; @@ -1100,7 +1109,8 @@ void gfx_display_draw_texture_slice( tex_coord[6] = T_TR[0] + tex_mid_width + tex_woff; tex_coord[7] = T_TR[1]; - gfx_display_draw(&draw, video_info); + gfx_display_draw(&draw, video_info->userdata, + video_info->width, video_info->height); /* middle-left section */ vert_coord[0] = V_BL[0]; @@ -1121,7 +1131,8 @@ void gfx_display_draw_texture_slice( tex_coord[6] = T_TR[0]; tex_coord[7] = T_TR[1] + tex_hoff; - gfx_display_draw(&draw, video_info); + gfx_display_draw(&draw, video_info->userdata, + video_info->width, video_info->height); /* center section */ vert_coord[0] = V_BL[0] + vert_woff; @@ -1142,7 +1153,8 @@ void gfx_display_draw_texture_slice( tex_coord[6] = T_TR[0] + tex_mid_width; tex_coord[7] = T_TR[1] + tex_hoff; - gfx_display_draw(&draw, video_info); + gfx_display_draw(&draw, video_info->userdata, + video_info->width, video_info->height); /* middle-right section */ vert_coord[0] = V_BL[0] + vert_woff + vert_scaled_mid_width; @@ -1163,7 +1175,8 @@ void gfx_display_draw_texture_slice( tex_coord[6] = T_TR[0] + tex_woff + tex_mid_width; tex_coord[7] = T_TR[1] + tex_hoff; - gfx_display_draw(&draw, video_info); + gfx_display_draw(&draw, video_info->userdata, + video_info->width, video_info->height); /* bottom-left corner */ vert_coord[0] = V_BL[0]; @@ -1184,7 +1197,8 @@ void gfx_display_draw_texture_slice( tex_coord[6] = T_TR[0]; tex_coord[7] = T_TR[1] + tex_hoff + tex_mid_height; - gfx_display_draw(&draw, video_info); + gfx_display_draw(&draw, video_info->userdata, + video_info->width, video_info->height); /* bottom-middle section */ vert_coord[0] = V_BL[0] + vert_woff; @@ -1205,7 +1219,8 @@ void gfx_display_draw_texture_slice( tex_coord[6] = T_TR[0] + tex_mid_width; tex_coord[7] = T_TR[1] + tex_hoff + tex_mid_height; - gfx_display_draw(&draw, video_info); + gfx_display_draw(&draw, video_info->userdata, + video_info->width, video_info->height); /* bottom-right corner */ vert_coord[0] = V_BL[0] + vert_woff + vert_scaled_mid_width; @@ -1226,7 +1241,8 @@ void gfx_display_draw_texture_slice( tex_coord[6] = T_TR[0] + tex_woff + tex_mid_width; tex_coord[7] = T_TR[1] + tex_hoff + tex_mid_height; - gfx_display_draw(&draw, video_info); + gfx_display_draw(&draw, video_info->userdata, + video_info->width, video_info->height); free(colors); free(vert_coord); @@ -1296,7 +1312,8 @@ void gfx_display_draw_cursor( draw.prim_type = GFX_DISPLAY_PRIM_TRIANGLESTRIP; draw.pipeline.id = 0; - gfx_display_draw(&draw, video_info); + gfx_display_draw(&draw, video_info->userdata, + video_info->width, video_info->height); if (dispctx && dispctx->blend_end) dispctx->blend_end(video_info->userdata); diff --git a/gfx/gfx_display.h b/gfx/gfx_display.h index 53865f7548..f836e93f5b 100644 --- a/gfx/gfx_display.h +++ b/gfx/gfx_display.h @@ -262,12 +262,21 @@ void gfx_display_set_framebuffer_dirty_flag(void); void gfx_display_unset_framebuffer_dirty_flag(void); bool gfx_display_init_first_driver(bool video_is_threaded); bool gfx_display_restore_clear_color(void); -void gfx_display_clear_color(gfx_display_ctx_clearcolor_t *color, - video_frame_info_t *video_info); + +/* TODO/FIXME - this is no longer used - consider getting rid of it */ +void gfx_display_clear_color(gfx_display_ctx_clearcolor_t *color, void *data); + void gfx_display_draw(gfx_display_ctx_draw_t *draw, - video_frame_info_t *video_info); -void gfx_display_draw_blend(gfx_display_ctx_draw_t *draw, - video_frame_info_t *video_info); + void *data, + unsigned video_width, + unsigned video_height); + +void gfx_display_draw_blend( + gfx_display_ctx_draw_t *draw, + void *data, + unsigned video_width, + unsigned video_height); + void gfx_display_draw_keyboard( uintptr_t hover_texture, const font_data_t *font, diff --git a/gfx/gfx_thumbnail.c b/gfx/gfx_thumbnail.c index 5d68a81d07..04488d7c67 100644 --- a/gfx/gfx_thumbnail.c +++ b/gfx/gfx_thumbnail.c @@ -832,7 +832,8 @@ void gfx_thumbnail_draw( draw.y = shadow_y; /* Draw shadow */ - gfx_display_draw(&draw, video_info); + gfx_display_draw(&draw, video_info->userdata, + video_info->width, video_info->height); } } @@ -844,7 +845,8 @@ void gfx_thumbnail_draw( draw.y = draw_y; /* Draw thumbnail */ - gfx_display_draw(&draw, video_info); + gfx_display_draw(&draw, video_info->userdata, + video_info->width, video_info->height); gfx_display_blend_end(video_info->userdata); } } diff --git a/gfx/gfx_widgets.c b/gfx/gfx_widgets.c index 42ad7d89dc..4ff8d55289 100644 --- a/gfx/gfx_widgets.c +++ b/gfx/gfx_widgets.c @@ -779,7 +779,8 @@ static void gfx_widgets_draw_icon( draw.prim_type = GFX_DISPLAY_PRIM_TRIANGLESTRIP; draw.pipeline.id = 0; - gfx_display_draw(&draw, video_info); + gfx_display_draw(&draw, video_info->userdata, + video_info->width, video_info->height); } #ifdef HAVE_TRANSLATE @@ -828,7 +829,8 @@ static void gfx_widgets_draw_icon_blend( draw.prim_type = GFX_DISPLAY_PRIM_TRIANGLESTRIP; draw.pipeline.id = 0; - gfx_display_draw_blend(&draw, video_info); + gfx_display_draw_blend(&draw, video_info->userdata, + video_info->width, video_info->height); } #endif diff --git a/menu/drivers/materialui.c b/menu/drivers/materialui.c index c4976673b3..6cca23c94d 100644 --- a/menu/drivers/materialui.c +++ b/menu/drivers/materialui.c @@ -1750,7 +1750,8 @@ static void materialui_draw_icon( draw.prim_type = GFX_DISPLAY_PRIM_TRIANGLESTRIP; draw.pipeline.id = 0; - gfx_display_draw(&draw, video_info); + gfx_display_draw(&draw, video_info->userdata, + video_info->width, video_info->height); gfx_display_blend_end(video_info->userdata); } @@ -3530,7 +3531,8 @@ static void materialui_render_background(materialui_handle_t *mui, video_frame_i /* Draw background */ gfx_display_blend_begin(video_info->userdata); gfx_display_draw_bg(&draw, video_info, add_opacity, opacity_override); - gfx_display_draw(&draw, video_info); + gfx_display_draw(&draw, video_info->userdata, + video_info->width, video_info->height); gfx_display_blend_end(video_info->userdata); } diff --git a/menu/drivers/ozone/ozone_display.c b/menu/drivers/ozone/ozone_display.c index f051f7a400..b639a17f15 100644 --- a/menu/drivers/ozone/ozone_display.c +++ b/menu/drivers/ozone/ozone_display.c @@ -245,7 +245,8 @@ void ozone_draw_icon( draw.prim_type = GFX_DISPLAY_PRIM_TRIANGLESTRIP; draw.pipeline.id = 0; - gfx_display_draw(&draw, video_info); + gfx_display_draw(&draw, video_info->userdata, + video_info->width, video_info->height); } void ozone_draw_backdrop(video_frame_info_t *video_info, float alpha) diff --git a/menu/drivers/stripes.c b/menu/drivers/stripes.c index f6cd74c72d..19c2a569f1 100644 --- a/menu/drivers/stripes.c +++ b/menu/drivers/stripes.c @@ -618,7 +618,8 @@ static void stripes_draw_icon( draw.y = draw.y + (icon_size-draw.width)/2; } #endif - gfx_display_draw(&draw, video_info); + gfx_display_draw(&draw, video_info->userdata, + video_info->width, video_info->height); } coords.color = (const float*)color; @@ -632,7 +633,8 @@ static void stripes_draw_icon( draw.y = draw.y + (icon_size-draw.width)/2; } #endif - gfx_display_draw(&draw, video_info); + gfx_display_draw(&draw, video_info->userdata, + video_info->width, video_info->height); } static void stripes_draw_text( @@ -2746,7 +2748,8 @@ static void stripes_draw_bg( draw.pipeline.id = 0; gfx_display_blend_begin(video_info->userdata); - gfx_display_draw(&draw, video_info); + gfx_display_draw(&draw, video_info->userdata, + video_info->width, video_info->height); gfx_display_blend_end(video_info->userdata); } @@ -2784,7 +2787,8 @@ static void stripes_draw_dark_layer( draw.pipeline.id = 0; gfx_display_blend_begin(video_info->userdata); - gfx_display_draw(&draw, video_info); + gfx_display_draw(&draw, video_info->userdata, + video_info->width, video_info->height); gfx_display_blend_end(video_info->userdata); } diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index c38cef6ddb..e3505cd352 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -810,7 +810,8 @@ static void xmb_draw_icon( draw.y = draw.y + (icon_size-draw.width)/2; } #endif - gfx_display_draw(&draw, video_info); + gfx_display_draw(&draw, video_info->userdata, + video_info->width, video_info->height); } coords.color = (const float*)color; @@ -824,7 +825,8 @@ static void xmb_draw_icon( draw.y = draw.y + (icon_size-draw.width)/2; } #endif - gfx_display_draw(&draw, video_info); + gfx_display_draw(&draw, video_info->userdata, + video_info->width, video_info->height); } static void xmb_draw_text( @@ -3713,7 +3715,8 @@ static void xmb_draw_bg( } } - gfx_display_draw(&draw, video_info); + gfx_display_draw(&draw, video_info->userdata, + video_info->width, video_info->height); gfx_display_blend_end(video_info->userdata); } @@ -3751,7 +3754,8 @@ static void xmb_draw_dark_layer( draw.pipeline.id = 0; gfx_display_blend_begin(video_info->userdata); - gfx_display_draw(&draw, video_info); + gfx_display_draw(&draw, video_info->userdata, + video_info->width, video_info->height); gfx_display_blend_end(video_info->userdata); }