(drivers font) Start making the code independent of video_frame_info

This commit is contained in:
twinaphex 2020-03-07 04:45:27 +01:00
parent f588e7f646
commit 3e891c6237
5 changed files with 68 additions and 34 deletions

View File

@ -23,6 +23,7 @@
#include "../common/gl1_common.h"
#include "../font_driver.h"
#include "../../configuration.h"
#include "../../verbosity.h"
/* TODO: Move viewport side effects to the caller: it's a source of bugs. */
@ -437,10 +438,16 @@ static void gl1_raster_font_render_msg(
int drop_x, drop_y;
GLfloat x, y, scale, drop_mod, drop_alpha;
enum text_alignment text_align = TEXT_ALIGN_LEFT;
bool full_screen = false ;
gl1_raster_t *font = (gl1_raster_t*)data;
unsigned width = video_info->width;
unsigned height = video_info->height;
bool full_screen = false;
gl1_raster_t *font = (gl1_raster_t*)data;
unsigned width = font->gl->video_width;
unsigned height = font->gl->video_height;
settings_t *settings = config_get_ptr();
float video_msg_pos_x = settings->floats.video_msg_pos_x;
float video_msg_pos_y = settings->floats.video_msg_pos_y;
float video_msg_color_r = settings->floats.video_msg_color_r;
float video_msg_color_g = settings->floats.video_msg_color_g;
float video_msg_color_b = settings->floats.video_msg_color_b;
if (!font || string_is_empty(msg))
return;
@ -468,15 +475,15 @@ static void gl1_raster_font_render_msg(
}
else
{
x = video_info->font_msg_pos_x;
y = video_info->font_msg_pos_y;
x = video_msg_pos_x;
y = video_msg_pos_y;
scale = 1.0f;
full_screen = true;
text_align = TEXT_ALIGN_LEFT;
color[0] = video_info->font_msg_color_r;
color[1] = video_info->font_msg_color_g;
color[2] = video_info->font_msg_color_b;
color[0] = video_msg_color_r;
color[1] = video_msg_color_g;
color[2] = video_msg_color_b;
color[3] = 1.0f;
drop_x = -2;

View File

@ -24,6 +24,7 @@
#include "../common/gl_core_common.h"
#include "../font_driver.h"
#include "../../configuration.h"
#include "../../verbosity.h"
/* TODO: Move viewport side effects to the caller: it's a source of bugs. */
@ -347,9 +348,15 @@ static void gl_core_raster_font_render_msg(
GLfloat x, y, scale, drop_mod, drop_alpha;
enum text_alignment text_align = TEXT_ALIGN_LEFT;
bool full_screen = false ;
gl_core_raster_t *font = (gl_core_raster_t*)data;
unsigned width = video_info->width;
unsigned height = video_info->height;
gl_core_raster_t *font = (gl_core_raster_t*)data;
unsigned width = font->gl->video_width;
unsigned height = font->gl->video_height;
settings_t *settings = config_get_ptr();
float video_msg_pos_x = settings->floats.video_msg_pos_x;
float video_msg_pos_y = settings->floats.video_msg_pos_y;
float video_msg_color_r = settings->floats.video_msg_color_r;
float video_msg_color_g = settings->floats.video_msg_color_g;
float video_msg_color_b = settings->floats.video_msg_color_b;
if (!font || string_is_empty(msg))
return;
@ -377,15 +384,15 @@ static void gl_core_raster_font_render_msg(
}
else
{
x = video_info->font_msg_pos_x;
y = video_info->font_msg_pos_y;
x = video_msg_pos_x;
y = video_msg_pos_y;
scale = 1.0f;
full_screen = true;
text_align = TEXT_ALIGN_LEFT;
color[0] = video_info->font_msg_color_r;
color[1] = video_info->font_msg_color_g;
color[2] = video_info->font_msg_color_b;
color[0] = video_msg_color_r;
color[1] = video_msg_color_g;
color[2] = video_msg_color_b;
color[3] = 1.0f;
drop_x = -2;

View File

@ -23,6 +23,7 @@
#include "../common/gl_common.h"
#include "../font_driver.h"
#include "../../configuration.h"
#include "../../verbosity.h"
/* TODO: Move viewport side effects to the caller: it's a source of bugs. */
@ -422,8 +423,14 @@ static void gl_raster_font_render_msg(
enum text_alignment text_align = TEXT_ALIGN_LEFT;
bool full_screen = false ;
gl_raster_t *font = (gl_raster_t*)data;
unsigned width = video_info->width;
unsigned height = video_info->height;
unsigned width = font->gl->video_width;
unsigned height = font->gl->video_height;
settings_t *settings = config_get_ptr();
float video_msg_pos_x = settings->floats.video_msg_pos_x;
float video_msg_pos_y = settings->floats.video_msg_pos_y;
float video_msg_color_r = settings->floats.video_msg_color_r;
float video_msg_color_g = settings->floats.video_msg_color_g;
float video_msg_color_b = settings->floats.video_msg_color_b;
if (!font || string_is_empty(msg))
return;
@ -451,15 +458,15 @@ static void gl_raster_font_render_msg(
}
else
{
x = video_info->font_msg_pos_x;
y = video_info->font_msg_pos_y;
x = video_msg_pos_x;
y = video_msg_pos_y;
scale = 1.0f;
full_screen = true;
text_align = TEXT_ALIGN_LEFT;
color[0] = video_info->font_msg_color_r;
color[1] = video_info->font_msg_color_g;
color[2] = video_info->font_msg_color_b;
color[0] = video_msg_color_r;
color[1] = video_msg_color_g;
color[2] = video_msg_color_b;
color[3] = 1.0f;
drop_x = -2;

View File

@ -22,6 +22,8 @@
#include "../font_driver.h"
#include "../../configuration.h"
typedef struct
{
vk_t *vk;
@ -341,18 +343,26 @@ static void vulkan_raster_font_render_msg(
int drop_x, drop_y;
bool full_screen;
unsigned max_glyphs;
unsigned width, height;
enum text_alignment text_align;
float x, y, scale, drop_mod, drop_alpha;
vk_t *vk = NULL;
vulkan_raster_t *font = (vulkan_raster_t*)data;
unsigned width = video_info->width;
unsigned height = video_info->height;
settings_t *settings = config_get_ptr();
float video_msg_pos_x = settings->floats.video_msg_pos_x;
float video_msg_pos_y = settings->floats.video_msg_pos_y;
float video_msg_color_r = settings->floats.video_msg_color_r;
float video_msg_color_g = settings->floats.video_msg_color_g;
float video_msg_color_b = settings->floats.video_msg_color_b;
if (!font || !msg || !*msg)
return;
vk = font->vk;
width = vk->video_width;
height = vk->video_height;
if (params)
{
x = params->x;
@ -376,8 +386,8 @@ static void vulkan_raster_font_render_msg(
}
else
{
x = video_info->font_msg_pos_x;
y = video_info->font_msg_pos_y;
x = video_msg_pos_x;
y = video_msg_pos_y;
scale = 1.0f;
full_screen = true;
text_align = TEXT_ALIGN_LEFT;
@ -386,9 +396,9 @@ static void vulkan_raster_font_render_msg(
drop_mod = 0.3f;
drop_alpha = 1.0f;
color[0] = video_info->font_msg_color_r;
color[1] = video_info->font_msg_color_g;
color[2] = video_info->font_msg_color_b;
color[0] = video_msg_color_r;
color[1] = video_msg_color_g;
color[2] = video_msg_color_b;
color[3] = 1.0f;
}

View File

@ -80,7 +80,10 @@ static void xfonts_render_msg(
{
float x, y;
wchar_t str[PATH_MAX_LENGTH];
xfonts_t *xfonts = (xfonts_t*)data;
xfonts_t *xfonts = (xfonts_t*)data;
settings_t *settings = config_get_ptr();
float video_msg_pos_x = settings->floats.video_msg_pos_x;
float video_msg_pos_y = settings->floats.video_msg_pos_y;
if (params)
{
@ -89,8 +92,8 @@ static void xfonts_render_msg(
}
else
{
x = video_info->font_msg_pos_x;
y = video_info->font_msg_pos_y;
x = video_msg_pos_x;
y = video_msg_pos_y;
}
d3d8_device_get_backbuffer(xfonts->d3d->dev,