Add menu_display_draw_polygon

This commit is contained in:
Jean-André Santoni 2018-04-08 18:58:11 +07:00
parent f2e71615fb
commit a6e9107bd0
2 changed files with 58 additions and 0 deletions

View File

@ -711,6 +711,56 @@ void menu_display_draw_quad(
menu_disp->blend_end(video_info);
}
void menu_display_draw_polygon(
video_frame_info_t *video_info,
int x1, int y1,
int x2, int y2,
int x3, int y3,
int x4, int y4,
unsigned width, unsigned height,
float *color)
{
menu_display_ctx_draw_t draw;
struct video_coords coords;
float vertex[8];
vertex[0] = x1 / (float)width;
vertex[1] = y1 / (float)height;
vertex[2] = x2 / (float)width;
vertex[3] = y2 / (float)height;
vertex[4] = x3 / (float)width;
vertex[5] = y3 / (float)height;
vertex[6] = x4 / (float)width;
vertex[7] = y4 / (float)height;
coords.vertices = 4;
coords.vertex = &vertex[0];
coords.tex_coord = NULL;
coords.lut_tex_coord = NULL;
coords.color = color;
if (menu_disp && menu_disp->blend_begin)
menu_disp->blend_begin(video_info);
draw.x = 0;
draw.y = 0;
draw.width = width;
draw.height = height;
draw.coords = &coords;
draw.matrix_data = NULL;
draw.texture = menu_display_white_texture;
draw.prim_type = MENU_DISPLAY_PRIM_TRIANGLESTRIP;
draw.pipeline.id = 0;
draw.scale_factor = 1.0f;
draw.rotation = 0.0f;
menu_display_draw(&draw, video_info);
if (menu_disp && menu_disp->blend_end)
menu_disp->blend_end(video_info);
}
void menu_display_draw_texture(
video_frame_info_t *video_info,
int x, int y, unsigned w, unsigned h,

View File

@ -692,6 +692,14 @@ void menu_display_draw_quad(
int x, int y, unsigned w, unsigned h,
unsigned width, unsigned height,
float *color);
void menu_display_draw_polygon(
video_frame_info_t *video_info,
int x1, int y1,
int x2, int y2,
int x3, int y3,
int x4, int y4,
unsigned width, unsigned height,
float *color);
void menu_display_draw_texture(
video_frame_info_t *video_info,
int x, int y, unsigned w, unsigned h,