move ozone_pure_white to ozone userdata

This commit is contained in:
twinaphex 2020-10-08 18:19:50 +02:00
parent 8a1711dd28
commit 2e94f3d5d7
7 changed files with 46 additions and 30 deletions

View File

@ -565,6 +565,7 @@ static void ozone_menu_animation_update_time(
static void *ozone_init(void **userdata, bool video_is_threaded)
{
unsigned i;
bool fallback_color_theme = false;
unsigned width, height, color_theme = 0;
ozone_handle_t *ozone = NULL;
@ -587,6 +588,9 @@ static void *ozone_init(void **userdata, bool video_is_threaded)
*userdata = ozone;
for (i = 0; i < 15; i++)
ozone->pure_white[i] = 1.00f;
ozone->last_width = width;
ozone->last_height = height;
ozone->last_scale_factor = gfx_display_get_dpi_scale(width, height);
@ -1953,6 +1957,8 @@ static void ozone_draw_header(ozone_handle_t *ozone,
menu_ticker_type = (enum gfx_animation_ticker_type)settings->uints.menu_ticker_type;
gfx_display_t *p_disp = disp_get_ptr();
gfx_display_ctx_driver_t *dispctx = p_disp->dispctx;
float *col = ozone->theme->entries_icon
? ozone->theme->entries_icon : ozone->pure_white;
/* Initial ticker configuration */
if (use_smooth_ticker)
@ -2037,7 +2043,7 @@ static void ozone_draw_header(ozone_handle_t *ozone,
14 * scale_factor, /* Where does this come from...? */
video_width,
video_height,
0, 1, ozone->theme->entries_icon);
0, 1, col);
else
#endif
ozone_draw_icon(
@ -2051,7 +2057,7 @@ static void ozone_draw_header(ozone_handle_t *ozone,
(ozone->dimensions.header_height - logo_icon_size) / 2,
video_width,
video_height,
0, 1, ozone->theme->entries_icon);
0, 1, col);
if (dispctx && dispctx->blend_end)
dispctx->blend_end(userdata);
@ -2100,7 +2106,7 @@ static void ozone_draw_header(ozone_handle_t *ozone,
0,
video_width,
video_height,
0, 1, ozone->theme->entries_icon);
0, 1, col);
if (dispctx && dispctx->blend_end)
dispctx->blend_end(userdata);
}
@ -2149,7 +2155,7 @@ static void ozone_draw_header(ozone_handle_t *ozone,
0,
video_width,
video_height,
0, 1, ozone->theme->entries_icon);
0, 1, col);
if (dispctx && dispctx->blend_end)
dispctx->blend_end(userdata);
}
@ -2211,6 +2217,8 @@ static void ozone_draw_footer(ozone_handle_t *ozone,
ozone->footer_labels.metadata_toggle.width - icon_size - (2.0f * icon_padding);
gfx_display_t *p_disp = disp_get_ptr();
gfx_display_ctx_driver_t *dispctx = p_disp->dispctx;
float *col = ozone->theme_dynamic.entries_icon
? ozone->theme_dynamic.entries_icon : ozone->pure_white;
/* Separator */
gfx_display_draw_quad(
@ -2246,7 +2254,7 @@ static void ozone_draw_footer(ozone_handle_t *ozone,
icon_y,
video_width,
video_height,
0, 1, ozone->theme_dynamic.entries_icon);
0, 1, col);
/* > back */
ozone_draw_icon(
@ -2261,7 +2269,7 @@ static void ozone_draw_footer(ozone_handle_t *ozone,
back_x,
icon_y,
video_width,video_height,
0, 1, ozone->theme_dynamic.entries_icon);
0, 1, col);
/* > search */
ozone_draw_icon(
@ -2274,7 +2282,7 @@ static void ozone_draw_footer(ozone_handle_t *ozone,
search_x,
icon_y,
video_width,video_height,
0, 1, ozone->theme_dynamic.entries_icon);
0, 1, col);
/* > fullscreen_thumbs */
if (fullscreen_thumbnails_available)
@ -2288,7 +2296,7 @@ static void ozone_draw_footer(ozone_handle_t *ozone,
fullscreen_thumbs_x,
icon_y,
video_width,video_height,
0, 1, ozone->theme_dynamic.entries_icon);
0, 1, col);
/* > metadata_toggle */
if (metadata_override_available)
@ -2302,7 +2310,7 @@ static void ozone_draw_footer(ozone_handle_t *ozone,
metadata_toggle_x,
icon_y,
video_width,video_height,
0, 1, ozone->theme_dynamic.entries_icon);
0, 1, col);
if (dispctx && dispctx->blend_end)
dispctx->blend_end(userdata);
@ -2484,7 +2492,7 @@ static void ozone_draw_footer(ozone_handle_t *ozone,
video_height,
0,
1,
NULL);
ozone->pure_white);
if (dispctx && dispctx->blend_end)
dispctx->blend_end(userdata);
}
@ -2913,14 +2921,14 @@ static void ozone_frame(void *data, video_frame_info_t *video_info)
{
bool cursor_visible = video_fullscreen && menu_mouse_enable;
gfx_display_set_alpha(ozone_pure_white, 1.0f);
gfx_display_set_alpha(ozone->pure_white, 1.0f);
if (cursor_visible)
gfx_display_draw_cursor(
userdata,
video_width,
video_height,
cursor_visible,
ozone_pure_white,
ozone->pure_white,
ozone->dimensions.cursor_size,
ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_POINTER],
ozone->pointer.x,

View File

@ -207,6 +207,7 @@ struct ozone_handle
float dimensions_sidebar_width; /* animated field */
float sidebar_offset;
float last_scale_factor;
float pure_white[16];
struct
{

View File

@ -314,7 +314,7 @@ void ozone_draw_icon(
coords.vertex = NULL;
coords.tex_coord = NULL;
coords.lut_tex_coord = NULL;
coords.color = color ? (const float*)color : ozone_pure_white;
coords.color = (const float*)color;
draw.x = x;
draw.y = height - y - icon_height;
@ -529,7 +529,7 @@ void ozone_draw_osk(ozone_handle_t *ozone,
ozone->fonts.entries_label.line_ascender,
video_width,
video_height,
ozone_pure_white);
ozone->pure_white);
}
}
else

View File

@ -67,6 +67,8 @@ static void ozone_draw_entry_value(
/* check icon */
if (entry->checked)
{
float *col = ozone->theme_dynamic.entries_checkmark
? ozone->theme_dynamic.entries_checkmark : ozone->pure_white;
if (dispctx && dispctx->blend_begin)
dispctx->blend_begin(userdata);
ozone_draw_icon(
@ -82,7 +84,7 @@ static void ozone_draw_entry_value(
video_height,
0,
1,
ozone->theme_dynamic.entries_checkmark);
col);
if (dispctx && dispctx->blend_end)
dispctx->blend_end(userdata);
return;
@ -182,6 +184,8 @@ static void ozone_draw_no_thumbnail_available(ozone_handle_t *ozone,
unsigned icon_size = (unsigned)((float)ozone->dimensions.sidebar_entry_icon_size * 1.5f);
gfx_display_t *p_disp = disp_get_ptr();
gfx_display_ctx_driver_t *dispctx = p_disp->dispctx;
float *col = ozone->theme->entries_icon
? ozone->theme->entries_icon : ozone->pure_white;
if (dispctx && dispctx->blend_begin)
dispctx->blend_begin(userdata);
@ -196,7 +200,7 @@ static void ozone_draw_no_thumbnail_available(ozone_handle_t *ozone,
video_height/2 - icon_size/2 - y_offset,
video_width,
video_height,
0, 1, ozone->theme->entries_icon);
0, 1, col);
if (dispctx && dispctx->blend_end)
dispctx->blend_end(userdata);
@ -787,7 +791,7 @@ border_iterate:
))
icon_color = ozone->theme_dynamic.entries_icon;
else
icon_color = ozone_pure_white;
icon_color = ozone->pure_white;
gfx_display_set_alpha(icon_color, alpha);
@ -813,7 +817,7 @@ border_iterate:
if (dispctx && dispctx->blend_end)
dispctx->blend_end(userdata);
if (icon_color == ozone_pure_white)
if (icon_color == ozone->pure_white)
gfx_display_set_alpha(icon_color, 1.0f);
text_offset = 0;
@ -1314,6 +1318,8 @@ void ozone_draw_thumbnail_bar(ozone_handle_t *ozone,
* is available */
if (metadata_override_enabled)
{
float *col = ozone->theme_dynamic.entries_icon
? ozone->theme_dynamic.entries_icon : ozone->pure_white;
/* Icon should be small and unobtrusive
* > Make it 80% of the normal entry icon size */
unsigned icon_size = (unsigned)((float)ozone->dimensions.sidebar_entry_icon_size * 0.8f);
@ -1336,7 +1342,7 @@ void ozone_draw_thumbnail_bar(ozone_handle_t *ozone,
video_height - ozone->dimensions.footer_height - ozone->dimensions.sidebar_entry_icon_padding - icon_size,
video_width,
video_height,
0, 1, ozone->theme_dynamic.entries_icon);
0, 1, col);
if (dispctx && dispctx->blend_end)
dispctx->blend_end(userdata);
}

View File

@ -323,6 +323,10 @@ void ozone_draw_sidebar(
unsigned icon = ozone_system_tabs_icons[ozone->tabs[i]];
uint32_t text_color = COLOR_TEXT_ALPHA((selected ? ozone->theme->text_selected_rgba : ozone->theme->text_rgba), text_alpha);
float *col = (selected ? ozone->theme->text_selected : ozone->theme->entries_icon);
if (!col)
col = ozone->pure_white;
/* Icon */
ozone_draw_icon(
@ -338,7 +342,7 @@ void ozone_draw_sidebar(
video_height,
0,
1,
(selected ? ozone->theme->text_selected : ozone->theme->entries_icon));
col);
value_idx = ozone_system_tabs_value[ozone->tabs[i]];
title = msg_hash_to_str(value_idx);
@ -397,10 +401,14 @@ void ozone_draw_sidebar(
uint32_t text_color = COLOR_TEXT_ALPHA((selected ? ozone->theme->text_selected_rgba : ozone->theme->text_rgba), text_alpha);
ozone_node_t *node = (ozone_node_t*) file_list_get_userdata_at_offset(&ozone->horizontal_list, i);
float *col = (selected ? ozone->theme->text_selected : ozone->theme->entries_icon);
if (!node)
goto console_iterate;
if (!col)
col = ozone->pure_white;
/* Icon */
ozone_draw_icon(
userdata,
@ -415,7 +423,7 @@ void ozone_draw_sidebar(
video_height,
0,
1,
(selected ? ozone->theme->text_selected : ozone->theme->entries_icon));
col);
/* Text */
if (ozone->sidebar_collapsed)

View File

@ -529,8 +529,8 @@ void ozone_set_color_theme(ozone_handle_t *ozone, unsigned color_theme)
memcpy(ozone->theme_dynamic.selection, ozone->theme->selection, sizeof(ozone->theme_dynamic.selection));
memcpy(ozone->theme_dynamic.entries_border, ozone->theme->entries_border, sizeof(ozone->theme_dynamic.entries_border));
memcpy(ozone->theme_dynamic.entries_icon, ozone->theme->entries_icon, sizeof(ozone->theme_dynamic.entries_icon));
memcpy(ozone->theme_dynamic.entries_checkmark, ozone_pure_white, sizeof(ozone->theme_dynamic.entries_checkmark));
memcpy(ozone->theme_dynamic.cursor_alpha, ozone_pure_white, sizeof(ozone->theme_dynamic.cursor_alpha));
memcpy(ozone->theme_dynamic.entries_checkmark, ozone->pure_white, sizeof(ozone->theme_dynamic.entries_checkmark));
memcpy(ozone->theme_dynamic.cursor_alpha, ozone->pure_white, sizeof(ozone->theme_dynamic.cursor_alpha));
memcpy(ozone->theme_dynamic.message_background, ozone->theme->message_background, sizeof(ozone->theme_dynamic.message_background));
ozone_restart_cursor_animation(ozone);

View File

@ -20,13 +20,6 @@
#include "ozone.h"
#include "ozone_texture.h"
static float ozone_pure_white[16] = {
1.00, 1.00, 1.00, 1.00,
1.00, 1.00, 1.00, 1.00,
1.00, 1.00, 1.00, 1.00,
1.00, 1.00, 1.00, 1.00,
};
typedef struct ozone_theme
{
/* Background color */