mirror of
https://github.com/libretro/RetroArch
synced 2025-04-24 15:02:35 +00:00
Don't grab these two variables for every blit_line call
This commit is contained in:
parent
c8b9b4ef25
commit
ca56e0e91d
@ -1445,13 +1445,12 @@ static void prepare_rgui_colors(rgui_t *rgui, settings_t *settings)
|
||||
rgui->force_redraw = true;
|
||||
}
|
||||
|
||||
static void blit_line(int x, int y,
|
||||
const char *message, uint16_t color, uint16_t shadow_color, bool draw_shadow)
|
||||
{
|
||||
size_t pitch = menu_display_get_framebuffer_pitch();
|
||||
const uint8_t *font_fb = menu_display_get_font_framebuffer();
|
||||
|
||||
if (font_fb)
|
||||
static void rgui_blit_line(
|
||||
size_t pitch,
|
||||
const uint8_t *font_fb,
|
||||
int x, int y,
|
||||
const char *message, uint16_t color,
|
||||
uint16_t shadow_color, bool draw_shadow)
|
||||
{
|
||||
/* We're going to do some ugly loop unswitching here
|
||||
* because rendering text is *very* expensive and I don't
|
||||
@ -1514,7 +1513,6 @@ static void blit_line(int x, int y,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void rgui_copy_glyph(uint8_t *glyph, const uint8_t *buf)
|
||||
@ -1662,7 +1660,8 @@ static void rgui_render_messagebox(rgui_t *rgui, const char *message)
|
||||
unsigned width, glyphs_width, height;
|
||||
struct string_list *list = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
size_t pitch = menu_display_get_framebuffer_pitch();
|
||||
const uint8_t *font_fb = menu_display_get_font_framebuffer();
|
||||
(void)settings;
|
||||
|
||||
if (!message || !*message)
|
||||
@ -1744,16 +1743,19 @@ static void rgui_render_messagebox(rgui_t *rgui, const char *message)
|
||||
}
|
||||
}
|
||||
|
||||
if (rgui_frame_buf.data)
|
||||
{
|
||||
for (i = 0; i < list->size; i++)
|
||||
{
|
||||
const char *msg = list->elems[i].data;
|
||||
int offset_x = (int)(FONT_WIDTH_STRIDE * (glyphs_width - utf8len(msg)) / 2);
|
||||
int offset_y = (int)(FONT_HEIGHT_STRIDE * i);
|
||||
|
||||
if (rgui_frame_buf.data)
|
||||
blit_line(x + 8 + offset_x, y + 8 + offset_y, msg,
|
||||
rgui_blit_line(pitch, font_fb,
|
||||
x + 8 + offset_x, y + 8 + offset_y, msg,
|
||||
rgui->colors.normal_color, rgui->colors.shadow_color, settings->bools.menu_rgui_shadows);
|
||||
}
|
||||
}
|
||||
|
||||
end:
|
||||
string_list_free(list);
|
||||
@ -1788,6 +1790,8 @@ static void rgui_render(void *data, bool is_idle)
|
||||
bool msg_force = false;
|
||||
settings_t *settings = config_get_ptr();
|
||||
rgui_t *rgui = (rgui_t*)data;
|
||||
size_t pitch = menu_display_get_framebuffer_pitch();
|
||||
const uint8_t *font_fb = menu_display_get_font_framebuffer();
|
||||
|
||||
static bool display_kb = false;
|
||||
bool current_display_cb = false;
|
||||
@ -1951,7 +1955,9 @@ static void rgui_render(void *data, bool is_idle)
|
||||
title_x - 5, 0, title_width + 10, FONT_HEIGHT_STRIDE, rgui_bg_filler);
|
||||
|
||||
/* Draw thumbnail title */
|
||||
blit_line((int)title_x, 0, thumbnail_title_buf,
|
||||
if (font_fb)
|
||||
rgui_blit_line(pitch, font_fb,
|
||||
(int)title_x, 0, thumbnail_title_buf,
|
||||
rgui->colors.hover_color, rgui->colors.shadow_color, settings->bools.menu_rgui_shadows);
|
||||
}
|
||||
}
|
||||
@ -2006,7 +2012,7 @@ static void rgui_render(void *data, bool is_idle)
|
||||
string_to_upper(title_buf);
|
||||
|
||||
if (rgui_frame_buf.data)
|
||||
blit_line(
|
||||
rgui_blit_line(pitch, font_fb,
|
||||
(int)(RGUI_TERM_START_X(fb_width) + (RGUI_TERM_WIDTH(fb_width)
|
||||
- utf8len(title_buf)) * FONT_WIDTH_STRIDE / 2),
|
||||
RGUI_TERM_START_Y(fb_height) - FONT_HEIGHT_STRIDE,
|
||||
@ -2150,7 +2156,8 @@ static void rgui_render(void *data, bool is_idle)
|
||||
}
|
||||
|
||||
if (rgui_frame_buf.data)
|
||||
blit_line(x, y, message,
|
||||
rgui_blit_line(pitch, font_fb,
|
||||
x, y, message,
|
||||
entry_selected ? rgui->colors.hover_color : rgui->colors.normal_color,
|
||||
rgui->colors.shadow_color, settings->bools.menu_rgui_shadows);
|
||||
|
||||
@ -2182,7 +2189,7 @@ static void rgui_render(void *data, bool is_idle)
|
||||
menu_animation_ticker(&ticker);
|
||||
|
||||
if (rgui_frame_buf.data)
|
||||
blit_line(
|
||||
rgui_blit_line(pitch, font_fb,
|
||||
RGUI_TERM_START_X(fb_width) + FONT_WIDTH_STRIDE,
|
||||
(RGUI_TERM_HEIGHT(fb_height) * FONT_HEIGHT_STRIDE) +
|
||||
RGUI_TERM_START_Y(fb_height) + 2, sublabel_buf,
|
||||
@ -2204,7 +2211,7 @@ static void rgui_render(void *data, bool is_idle)
|
||||
menu_animation_ticker(&ticker);
|
||||
|
||||
if (rgui_frame_buf.data)
|
||||
blit_line(
|
||||
rgui_blit_line(pitch, font_fb,
|
||||
RGUI_TERM_START_X(fb_width) + FONT_WIDTH_STRIDE,
|
||||
(RGUI_TERM_HEIGHT(fb_height) * FONT_HEIGHT_STRIDE) +
|
||||
RGUI_TERM_START_Y(fb_height) + 2, core_title_buf,
|
||||
@ -2227,7 +2234,7 @@ static void rgui_render(void *data, bool is_idle)
|
||||
menu_display_timedate(&datetime);
|
||||
|
||||
if (rgui_frame_buf.data)
|
||||
blit_line(
|
||||
rgui_blit_line(pitch, font_fb,
|
||||
timedate_x,
|
||||
(RGUI_TERM_HEIGHT(fb_height) * FONT_HEIGHT_STRIDE) +
|
||||
RGUI_TERM_START_Y(fb_height) + 2, timedate,
|
||||
|
Loading…
x
Reference in New Issue
Block a user