Get rid of gfx_display_set_msg_force

This commit is contained in:
twinaphex 2021-09-21 21:10:38 +02:00
parent 522dd72bd0
commit 6eeebeab25
6 changed files with 74 additions and 74 deletions

View File

@ -256,7 +256,7 @@ float gfx_display_get_dpi_scale_internal(
#endif
/* Get pixel scale relative to baseline 1080p display */
pixel_scale = diagonal_pixels / DIAGONAL_PIXELS_1080P;
pixel_scale = diagonal_pixels / DIAGONAL_PIXELS_1080P;
/* Attempt to get display DPI */
metrics.type = DISPLAY_METRIC_DPI;
@ -456,43 +456,40 @@ void gfx_display_scissor_begin(
int x, int y, unsigned width, unsigned height)
{
gfx_display_ctx_driver_t *dispctx = p_disp->dispctx;
if (dispctx && dispctx->scissor_begin)
if (y < 0)
{
if (y < 0)
{
if (height < (unsigned)(-y))
height = 0;
else
height += y;
y = 0;
}
if (x < 0)
{
if (width < (unsigned)(-x))
width = 0;
else
width += x;
x = 0;
}
if (y >= (int)video_height)
{
height = 0;
y = 0;
}
if (x >= (int)video_width)
{
width = 0;
x = 0;
}
if ((y + height) > video_height)
height = video_height - y;
if ((x + width) > video_width)
width = video_width - x;
dispctx->scissor_begin(userdata,
video_width, video_height,
x, y, width, height);
if (height < (unsigned)(-y))
height = 0;
else
height += y;
y = 0;
}
if (x < 0)
{
if (width < (unsigned)(-x))
width = 0;
else
width += x;
x = 0;
}
if (y >= (int)video_height)
{
height = 0;
y = 0;
}
if (x >= (int)video_width)
{
width = 0;
x = 0;
}
if ((y + height) > video_height)
height = video_height - y;
if ((x + width) > video_width)
width = video_width - x;
dispctx->scissor_begin(userdata,
video_width, video_height,
x, y, width, height);
}
font_data_t *gfx_display_font_file(
@ -1154,12 +1151,6 @@ void gfx_display_set_framebuffer_pitch(size_t pitch)
p_disp->framebuf_pitch = pitch;
}
void gfx_display_set_msg_force(bool state)
{
gfx_display_t *p_disp = disp_get_ptr();
p_disp->msg_force = state;
}
void gfx_display_draw_keyboard(
gfx_display_t *p_disp,
void *userdata,

View File

@ -264,7 +264,6 @@ void gfx_display_get_fb_size(unsigned *fb_width, unsigned *fb_height,
void gfx_display_set_height(unsigned height);
void gfx_display_set_framebuffer_pitch(size_t pitch);
void gfx_display_set_msg_force(bool state);
bool gfx_display_init_first_driver(gfx_display_t *p_disp,
bool video_is_threaded);

View File

@ -1257,10 +1257,11 @@ static void gfx_widgets_draw_task_msg(
gfx_widgets_flush_text(video_width, video_height,
&p_dispwidget->gfx_widget_fonts.msg_queue);
gfx_display_scissor_begin(p_disp,
userdata,
video_width, video_height,
rect_x, rect_y, rect_width, rect_height);
if (p_disp->dispctx && p_disp->dispctx->scissor_begin)
gfx_display_scissor_begin(p_disp,
userdata,
video_width, video_height,
rect_x, rect_y, rect_width, rect_height);
gfx_widgets_draw_text(&p_dispwidget->gfx_widget_fonts.msg_queue,
msg->msg_new,
@ -1342,13 +1343,14 @@ static void gfx_widgets_draw_regular_msg(
gfx_widgets_flush_text(video_width, video_height,
&p_dispwidget->gfx_widget_fonts.msg_queue);
gfx_display_scissor_begin(p_disp,
userdata,
video_width, video_height,
p_dispwidget->msg_queue_scissor_start_x, 0,
(p_dispwidget->msg_queue_scissor_start_x + msg->width -
p_dispwidget->simple_widget_padding * 2)
* msg->unfold, video_height);
if (p_disp->dispctx && p_disp->dispctx->scissor_begin)
gfx_display_scissor_begin(p_disp,
userdata,
video_width, video_height,
p_dispwidget->msg_queue_scissor_start_x, 0,
(p_dispwidget->msg_queue_scissor_start_x + msg->width -
p_dispwidget->simple_widget_padding * 2)
* msg->unfold, video_height);
}
/* Background */

View File

@ -1923,11 +1923,11 @@ static int generic_action_ok(const char *path,
bool config_save_on_exit = settings->bools.config_save_on_exit;
flush_type = MENU_SETTINGS;
gfx_display_set_msg_force(true);
disp_get_ptr()->msg_force = true;
if (config_replace(config_save_on_exit, action_path))
{
bool pending_push = false;
bool pending_push = false;
menu_driver_ctl(MENU_NAVIGATION_CTL_CLEAR, &pending_push);
ret = -1;
}

View File

@ -2730,14 +2730,15 @@ static void ozone_draw_sidebar(
horizontal_list_size = (unsigned)ozone->horizontal_list.size;
gfx_display_scissor_begin(
p_disp,
userdata,
video_width, video_height,
0,
ozone->dimensions.header_height + ozone->dimensions.spacer_1px,
(unsigned) ozone->dimensions_sidebar_width,
video_height - ozone->dimensions.header_height - ozone->dimensions.footer_height - ozone->dimensions.spacer_1px);
if (p_disp->dispctx && p_disp->dispctx->scissor_begin)
gfx_display_scissor_begin(
p_disp,
userdata,
video_width, video_height,
0,
ozone->dimensions.header_height + ozone->dimensions.spacer_1px,
(unsigned) ozone->dimensions_sidebar_width,
video_height - ozone->dimensions.header_height - ozone->dimensions.footer_height - ozone->dimensions.spacer_1px);
/* Background */
sidebar_height = video_height - ozone->dimensions.header_height - ozone->dimensions.sidebar_gradient_height * 2 - ozone->dimensions.footer_height;
@ -9226,15 +9227,22 @@ static void ozone_frame(void *data, video_frame_info_t *video_info)
&mymat);
/* Menu entries */
gfx_display_scissor_begin(p_disp,
userdata,
video_width,
video_height,
ozone->sidebar_offset + (unsigned) ozone->dimensions_sidebar_width,
ozone->dimensions.header_height + ozone->dimensions.spacer_1px,
video_width - (unsigned) ozone->dimensions_sidebar_width
+ (-ozone->sidebar_offset),
video_height - ozone->dimensions.header_height - ozone->dimensions.footer_height - ozone->dimensions.spacer_1px);
if (p_disp->dispctx && p_disp->dispctx->scissor_begin)
gfx_display_scissor_begin(p_disp,
userdata,
video_width,
video_height,
ozone->sidebar_offset
+ (unsigned)ozone->dimensions_sidebar_width,
ozone->dimensions.header_height
+ ozone->dimensions.spacer_1px,
video_width
- (unsigned) ozone->dimensions_sidebar_width
+ (-ozone->sidebar_offset),
video_height
- ozone->dimensions.header_height
- ozone->dimensions.footer_height
- ozone->dimensions.spacer_1px);
/* Current list */
ozone_draw_entries(

View File

@ -28540,7 +28540,7 @@ static enum runloop_state runloop_check_state(
* and exit the function to go to the next frame.
*/
menu_entries_flush_stack(NULL, MENU_SETTINGS);
gfx_display_set_msg_force(true);
disp_get_ptr()->msg_force = true;
generic_action_ok_displaylist_push("", NULL,
"", 0, 0, 0, ACTION_OK_DL_CONTENT_SETTINGS);