From a6e9107bd042b77e3b9ca0033eb010ddf448520d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Sun, 8 Apr 2018 18:58:11 +0700 Subject: [PATCH] Add menu_display_draw_polygon --- menu/menu_driver.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++ menu/menu_driver.h | 8 ++++++++ 2 files changed, 58 insertions(+) diff --git a/menu/menu_driver.c b/menu/menu_driver.c index 0912114c17..d19d97ef03 100644 --- a/menu/menu_driver.c +++ b/menu/menu_driver.c @@ -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, diff --git a/menu/menu_driver.h b/menu/menu_driver.h index d36214da0a..1bfaab22bb 100644 --- a/menu/menu_driver.h +++ b/menu/menu_driver.h @@ -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,