mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-01-11 13:26:34 +00:00
Merge pull request #8559 from jdgleaver/font-alignment
(Menu Widgets) Fix text alignment issues with Vulkan and D3D video drivers
This commit is contained in:
commit
682d757cf7
@ -2366,7 +2366,7 @@ static void vulkan_unload_texture(void *data, uintptr_t handle)
|
||||
{
|
||||
vk_t *vk = (vk_t*)data;
|
||||
struct vk_texture *texture = (struct vk_texture*)handle;
|
||||
if (!texture)
|
||||
if (!texture || !vk)
|
||||
return;
|
||||
|
||||
/* TODO: We really want to defer this deletion instead,
|
||||
|
@ -178,8 +178,8 @@ static void d3d10_font_render_line(
|
||||
if (!glyph)
|
||||
continue;
|
||||
|
||||
v->pos.x = (x + glyph->draw_offset_x) * scale / (float)d3d10->viewport.Width;
|
||||
v->pos.y = (y + glyph->draw_offset_y) * scale / (float)d3d10->viewport.Height;
|
||||
v->pos.x = (x + (glyph->draw_offset_x * scale)) / (float)d3d10->viewport.Width;
|
||||
v->pos.y = (y + (glyph->draw_offset_y * scale)) / (float)d3d10->viewport.Height;
|
||||
v->pos.w = glyph->width * scale / (float)d3d10->viewport.Width;
|
||||
v->pos.h = glyph->height * scale / (float)d3d10->viewport.Height;
|
||||
|
||||
|
@ -176,8 +176,8 @@ static void d3d11_font_render_line(
|
||||
if (!glyph)
|
||||
continue;
|
||||
|
||||
v->pos.x = (x + glyph->draw_offset_x) * scale / (float)d3d11->viewport.Width;
|
||||
v->pos.y = (y + glyph->draw_offset_y) * scale / (float)d3d11->viewport.Height;
|
||||
v->pos.x = (x + (glyph->draw_offset_x * scale)) / (float)d3d11->viewport.Width;
|
||||
v->pos.y = (y + (glyph->draw_offset_y * scale)) / (float)d3d11->viewport.Height;
|
||||
v->pos.w = glyph->width * scale / (float)d3d11->viewport.Width;
|
||||
v->pos.h = glyph->height * scale / (float)d3d11->viewport.Height;
|
||||
|
||||
|
@ -184,8 +184,8 @@ static void d3d12_font_render_line(
|
||||
if (!glyph)
|
||||
continue;
|
||||
|
||||
v->pos.x = (x + glyph->draw_offset_x) * scale / (float)d3d12->chain.viewport.Width;
|
||||
v->pos.y = (y + glyph->draw_offset_y) * scale / (float)d3d12->chain.viewport.Height;
|
||||
v->pos.x = (x + (glyph->draw_offset_x * scale)) / (float)d3d12->chain.viewport.Width;
|
||||
v->pos.y = (y + (glyph->draw_offset_y * scale)) / (float)d3d12->chain.viewport.Height;
|
||||
v->pos.w = glyph->width * scale / (float)d3d12->chain.viewport.Width;
|
||||
v->pos.h = glyph->height * scale / (float)d3d12->chain.viewport.Height;
|
||||
|
||||
|
@ -203,8 +203,8 @@ static void vulkan_raster_font_render_line(
|
||||
height = glyph->height;
|
||||
|
||||
vulkan_write_quad_vbo(font->pv + font->vertices,
|
||||
(x + off_x + delta_x * scale) * inv_win_width,
|
||||
(y + off_y + delta_y * scale) * inv_win_height,
|
||||
(x + (off_x + delta_x) * scale) * inv_win_width,
|
||||
(y + (off_y + delta_y) * scale) * inv_win_height,
|
||||
width * scale * inv_win_width,
|
||||
height * scale * inv_win_height,
|
||||
tex_x * inv_tex_size_x,
|
||||
|
@ -208,7 +208,7 @@ static char *menu_widgets_icons_names[MENU_WIDGETS_ICON_LAST] = {
|
||||
"menu_info.png"
|
||||
};
|
||||
|
||||
static menu_texture_item menu_widgets_icons_textures[MENU_WIDGETS_ICON_LAST];
|
||||
static menu_texture_item menu_widgets_icons_textures[MENU_WIDGETS_ICON_LAST] = {0};
|
||||
|
||||
/* Volume */
|
||||
static float volume_db = 0.0f;
|
||||
@ -1776,6 +1776,9 @@ void menu_widgets_free(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!menu_widgets_inited)
|
||||
return;
|
||||
|
||||
menu_widgets_inited = false;
|
||||
|
||||
/* Kill any pending animation */
|
||||
@ -2078,4 +2081,4 @@ void menu_widgets_start_load_content_animation(const char *content_name, bool re
|
||||
bool menu_widgets_ready(void)
|
||||
{
|
||||
return menu_widgets_inited;
|
||||
}
|
||||
}
|
||||
|
@ -700,6 +700,13 @@ void driver_uninit(int flags)
|
||||
#ifdef HAVE_MENU
|
||||
if (flags & DRIVER_MENU_MASK)
|
||||
{
|
||||
#if defined(HAVE_MENU_WIDGETS)
|
||||
/* This absolutely has to be done before video_driver_free()
|
||||
* is called/completes, otherwise certain menu drivers
|
||||
* (e.g. Vulkan) will segfault */
|
||||
menu_widgets_context_destroy();
|
||||
menu_widgets_free();
|
||||
#endif
|
||||
menu_driver_ctl(RARCH_MENU_CTL_DEINIT, NULL);
|
||||
menu_driver_free();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user