diff --git a/menu/drivers/materialui.c b/menu/drivers/materialui.c index b73ff5502a..69bd501408 100644 --- a/menu/drivers/materialui.c +++ b/menu/drivers/materialui.c @@ -176,7 +176,7 @@ static void mui_draw_icon(mui_handle_t *mui, struct gfx_coords coords; math_matrix_4x4 mymat; - menu_display_blend_begin(); + menu_display_ctl(MENU_DISPLAY_CTL_BLEND_BEGIN, NULL); menu_display_matrix_4x4_rotate_z(&mymat, rotation, scale_factor, scale_factor, 1, true); @@ -194,7 +194,7 @@ static void mui_draw_icon(mui_handle_t *mui, &coords, &mymat, texture, MENU_DISPLAY_PRIM_TRIANGLESTRIP); - menu_display_blend_end(); + menu_display_ctl(MENU_DISPLAY_CTL_BLEND_END, NULL); } @@ -266,7 +266,7 @@ static void mui_render_quad(mui_handle_t *mui, coords.lut_tex_coord = NULL; coords.color = coord_color; - menu_display_blend_begin(); + menu_display_ctl(MENU_DISPLAY_CTL_BLEND_BEGIN, NULL); menu_display_draw( x, @@ -276,7 +276,7 @@ static void mui_render_quad(mui_handle_t *mui, &coords, NULL, mui->textures.white, MENU_DISPLAY_PRIM_TRIANGLESTRIP); - menu_display_blend_end(); + menu_display_ctl(MENU_DISPLAY_CTL_BLEND_END, NULL); } static void mui_draw_tab_begin(mui_handle_t *mui, @@ -624,7 +624,7 @@ static void mui_draw_cursor(mui_handle_t *mui, coords.lut_tex_coord = NULL; coords.color = (const float*)color; - menu_display_blend_begin(); + menu_display_ctl(MENU_DISPLAY_CTL_BLEND_BEGIN, NULL); menu_display_draw( x - 32, @@ -635,7 +635,7 @@ static void mui_draw_cursor(mui_handle_t *mui, mui->textures.list[MUI_TEXTURE_POINTER].id, MENU_DISPLAY_PRIM_TRIANGLESTRIP); - menu_display_blend_end(); + menu_display_ctl(MENU_DISPLAY_CTL_BLEND_END, NULL); } static size_t mui_list_get_size(void *data, menu_list_type_t type) diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 13afe5a1f8..18c47534dc 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -1480,7 +1480,7 @@ static void xmb_draw_items(xmb_handle_t *xmb, TEXT_ALIGN_LEFT, width, height); - menu_display_blend_begin(); + menu_display_ctl(MENU_DISPLAY_CTL_BLEND_BEGIN, NULL); /* set alpha components of color */ color[3] = color[7] = color[11] = color[15] = (node->alpha > xmb->alpha) ? xmb->alpha : node->alpha; @@ -1503,7 +1503,7 @@ static void xmb_draw_items(xmb_handle_t *xmb, 0, 1, &color[0]); - menu_display_blend_end(); + menu_display_ctl(MENU_DISPLAY_CTL_BLEND_END, NULL); } } @@ -1519,7 +1519,7 @@ static void xmb_draw_cursor(xmb_handle_t *xmb, coords.lut_tex_coord = NULL; coords.color = (const float*)color; - menu_display_blend_begin(); + menu_display_ctl(MENU_DISPLAY_CTL_BLEND_BEGIN, NULL); menu_display_draw( x - (xmb->cursor.size/2), @@ -1529,7 +1529,7 @@ static void xmb_draw_cursor(xmb_handle_t *xmb, &coords, NULL, xmb->textures.list[XMB_TEXTURE_POINTER].id, MENU_DISPLAY_PRIM_TRIANGLESTRIP); - menu_display_blend_end(); + menu_display_ctl(MENU_DISPLAY_CTL_BLEND_END, NULL); } static void xmb_render(void *data) @@ -1602,7 +1602,7 @@ static void xmb_frame_horizontal_list(xmb_handle_t *xmb, if (!node) continue; - menu_display_blend_begin(); + menu_display_ctl(MENU_DISPLAY_CTL_BLEND_BEGIN, NULL); /* set alpha components of color */ color[3] = color[7] = color[11] = color[15] = (node->alpha > xmb->alpha) ? xmb->alpha : node->alpha; @@ -1618,7 +1618,7 @@ static void xmb_frame_horizontal_list(xmb_handle_t *xmb, node->zoom, &color[0]); - menu_display_blend_end(); + menu_display_ctl(MENU_DISPLAY_CTL_BLEND_END, NULL); } } @@ -1710,7 +1710,7 @@ static void xmb_frame(void *data) menu_display_matrix_4x4_rotate_z(&mymat, 0, 1, 1, 1, true); - menu_display_blend_begin(); + menu_display_ctl(MENU_DISPLAY_CTL_BLEND_BEGIN, NULL); if (settings->menu.boxart_enable && xmb->boxart) xmb_draw_boxart(xmb, &coord_color2[0], width, height); diff --git a/menu/drivers/zarch.c b/menu/drivers/zarch.c index 2a5bf99f64..da5f255901 100644 --- a/menu/drivers/zarch.c +++ b/menu/drivers/zarch.c @@ -1019,7 +1019,7 @@ static void zarch_frame(void *data) else if (zui->item.active == 0) zui->item.active = -1; - menu_display_blend_begin(); + menu_display_ctl(MENU_DISPLAY_CTL_BLEND_BEGIN, NULL); menu_display_draw( 0, @@ -1030,7 +1030,7 @@ static void zarch_frame(void *data) &zui->mvp, zui->textures.white, MENU_DISPLAY_PRIM_TRIANGLES); - menu_display_blend_end(); + menu_display_ctl(MENU_DISPLAY_CTL_BLEND_END, NULL); menu_display_draw_bg( zui->width, zui->height, diff --git a/menu/menu_display.c b/menu/menu_display.c index 892fe4c7c8..8e016110d7 100644 --- a/menu/menu_display.c +++ b/menu/menu_display.c @@ -234,6 +234,16 @@ bool menu_display_ctl(enum menu_display_ctl_state state, void *data) switch (state) { + case MENU_DISPLAY_CTL_BLEND_BEGIN: + if (!menu_disp || !menu_disp->blend_begin) + return false; + menu_disp->blend_begin(); + break; + case MENU_DISPLAY_CTL_BLEND_END: + if (!menu_disp || !menu_disp->blend_end) + return false; + menu_disp->blend_end(); + break; case MENU_DISPLAY_CTL_FONT_FLUSH_BLOCK: if (!disp || !disp->font.buf) return false; @@ -530,23 +540,6 @@ void menu_display_msg_queue_push(const char *msg, unsigned prio, unsigned durati } -void menu_display_blend_begin(void) -{ - menu_display_ctx_driver_t *menu_disp = menu_display_context_get_ptr(); - if (!menu_disp || !menu_disp->blend_begin) - return; - - menu_disp->blend_begin(); -} - -void menu_display_blend_end(void) -{ - menu_display_ctx_driver_t *menu_disp = menu_display_context_get_ptr(); - if (!menu_disp || !menu_disp->blend_end) - return; - - menu_disp->blend_end(); -} void menu_display_matrix_4x4_rotate_z(void *data, float rotation, float scale_x, float scale_y, float scale_z, bool scale_enable) diff --git a/menu/menu_display.h b/menu/menu_display.h index 428db96ae0..4b0f33f684 100644 --- a/menu/menu_display.h +++ b/menu/menu_display.h @@ -63,7 +63,9 @@ enum menu_display_ctl_state MENU_DISPLAY_CTL_FONT_FLUSH_BLOCK, MENU_DISPLAY_CTL_SET_FONT_BUF, MENU_DISPLAY_CTL_FONT_FB, - MENU_DISPLAY_CTL_SET_FONT_FB + MENU_DISPLAY_CTL_SET_FONT_FB, + MENU_DISPLAY_CTL_BLEND_BEGIN, + MENU_DISPLAY_CTL_BLEND_END }; enum menu_display_prim_type @@ -165,10 +167,6 @@ void menu_display_draw_bg( void menu_display_matrix_4x4_rotate_z(void *data, float rotation, float scale_x, float scale_y, float scale_z, bool scale_enable); -void menu_display_blend_begin(void); - -void menu_display_blend_end(void); - unsigned menu_display_texture_load(void *data, enum texture_filter_type filter_type);