gfx_display_draw - remove video_frame_info dependency

This commit is contained in:
twinaphex 2020-03-08 22:52:02 +01:00
parent d42a76dec1
commit 044619281c
8 changed files with 87 additions and 46 deletions

View File

@ -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);

View File

@ -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,

View File

@ -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);
}
}

View File

@ -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

View File

@ -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);
}

View File

@ -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)

View File

@ -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);
}

View File

@ -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);
}