(gfx/drivers_font) Style nits

This commit is contained in:
twinaphex 2017-01-12 10:26:12 +01:00
parent b2ad5274b3
commit 52ad8fb125
7 changed files with 109 additions and 109 deletions

View File

@ -77,11 +77,10 @@ static const struct font_glyph *caca_font_get_glyph(
static void caca_render_msg(void *data, const char *msg,
const void *userdata)
{
caca_raster_t *font = (caca_raster_t*)data;
float x, y;
unsigned width, height;
unsigned newX, newY;
settings_t *settings = config_get_ptr();
caca_raster_t *font = (caca_raster_t*)data;
const struct font_params *params = (const struct font_params*)userdata;
if (!font || string_is_empty(msg))
@ -94,6 +93,8 @@ static void caca_render_msg(void *data, const char *msg,
}
else
{
settings_t *settings = config_get_ptr();
x = settings->video.msg_pos_x;
y = settings->video.msg_pos_y;
}

View File

@ -341,12 +341,11 @@ static void ctr_font_render_msg(void* data, const char* msg,
const void* userdata)
{
float x, y, scale, drop_mod, drop_alpha;
unsigned color, color_dark, r, g, b, alpha, r_dark, g_dark, b_dark, alpha_dark;
unsigned width, height;
int drop_x, drop_y;
unsigned max_glyphs;
enum text_alignment text_align;
settings_t* settings = config_get_ptr();
unsigned color, color_dark, r, g, b, alpha, r_dark, g_dark, b_dark, alpha_dark;
ctr_font_t * font = (ctr_font_t*)data;
const struct font_params* params = (const struct font_params*)userdata;
@ -357,7 +356,6 @@ static void ctr_font_render_msg(void* data, const char* msg,
if (params)
{
// printf("%s\n", msg);
x = params->x;
y = params->y;
scale = params->scale;
@ -371,10 +369,11 @@ static void ctr_font_render_msg(void* data, const char* msg,
b = FONT_COLOR_GET_BLUE(params->color);
alpha = FONT_COLOR_GET_ALPHA(params->color);
color = params->color;
// color = COLOR_ABGR(r, g, b, alpha);
}
else
{
settings_t* settings = config_get_ptr();
x = settings->video.msg_pos_x;
y = settings->video.msg_pos_y;
scale = 1.0f;

View File

@ -68,7 +68,6 @@ static void libdbg_font_render_msg(void *data, const char *msg,
{
float x, y, scale;
unsigned color;
settings_t *settings = config_get_ptr();
const struct font_params *params = (const struct font_params*)userdata;
(void)data;
@ -82,6 +81,7 @@ static void libdbg_font_render_msg(void *data, const char *msg,
}
else
{
settings_t *settings = config_get_ptr();
x = settings->video.msg_pos_x;
y = 0.90f;
scale = 1.04f;

View File

@ -20,6 +20,8 @@
#include "../font_driver.h"
#include "../../configuration.h"
typedef struct
{
vita_video_t *vita;
@ -27,10 +29,8 @@ typedef struct
const font_renderer_driver_t *font_driver;
void *font_data;
struct font_atlas *atlas;
} vita_font_t;
static void *vita2d_font_init_font(void *data, const char *font_path, float font_size)
{
unsigned int stride, pitch, j, k;
@ -114,6 +114,7 @@ static int vita2d_font_get_message_width(void *data, const char *msg,
for (i = 0; i < msg_len; i++)
{
const struct font_glyph *glyph = NULL;
const char *msg_tmp = &msg[i];
unsigned code = utf8_walk(&msg_tmp);
unsigned skip = msg_tmp - &msg[i];
@ -121,8 +122,8 @@ static int vita2d_font_get_message_width(void *data, const char *msg,
if (skip > 1)
i += skip - 1;
const struct font_glyph *glyph =
font->font_driver->get_glyph(font->font_data, code);
glyph = font->font_driver->get_glyph(font->font_data, code);
if (!glyph) /* Do something smarter here ... */
glyph = font->font_driver->get_glyph(font->font_data, '?');
@ -165,6 +166,7 @@ static void vita2d_font_render_line(
{
int off_x, off_y, tex_x, tex_y, width, height;
unsigned int stride, pitch, j, k;
const struct font_glyph *glyph = NULL;
const uint8_t *frame32 = NULL;
uint8_t *tex32 = NULL;
const char *msg_tmp = &msg[i];
@ -174,11 +176,11 @@ static void vita2d_font_render_line(
if (skip > 1)
i += skip - 1;
const struct font_glyph *glyph =
font->font_driver->get_glyph(font->font_data, code);
glyph = font->font_driver->get_glyph(font->font_data, code);
if (!glyph) /* Do something smarter here ... */
glyph = font->font_driver->get_glyph(font->font_data, '?');
if (!glyph)
continue;
@ -221,8 +223,8 @@ static void vita2d_font_render_message(
const unsigned int color, float pos_x, float pos_y,
unsigned text_align)
{
int lines = 0;
float line_height;
int lines = 0;
if (!msg || !*msg)
return;
@ -241,38 +243,30 @@ static void vita2d_font_render_message(
for (;;)
{
const char *delim = strchr(msg, '\n');
unsigned msg_len = (delim) ? (delim - msg) : strlen(msg);
vita2d_font_render_line(font, msg, msg_len,
scale, color, pos_x, pos_y - (float)lines * line_height,
text_align);
/* Draw the line */
if (delim)
{
unsigned msg_len = delim - msg;
vita2d_font_render_line(font, msg, msg_len,
scale, color, pos_x, pos_y - (float)lines * line_height,
text_align);
if (!delim)
break;
msg += msg_len + 1;
lines++;
}
else
{
unsigned msg_len = strlen(msg);
vita2d_font_render_line(font, msg, msg_len,
scale, color, pos_x, pos_y - (float)lines * line_height,
text_align);
break;
}
}
}
static void vita2d_font_render_msg(void *data, const char *msg,
const void *userdata)
{
float x, y, scale, drop_mod, drop_alpha;
unsigned color, color_dark, r, g, b, alpha, r_dark, g_dark, b_dark, alpha_dark;
unsigned width, height;
int drop_x, drop_y;
unsigned max_glyphs;
enum text_alignment text_align;
settings_t *settings = config_get_ptr();
unsigned color, color_dark, r, g, b, alpha, r_dark, g_dark, b_dark, alpha_dark;
vita_font_t *font = (vita_font_t *)data;
const struct font_params *params = (const struct font_params*)userdata;
@ -299,6 +293,8 @@ static void vita2d_font_render_msg(void *data, const char *msg,
}
else
{
settings_t *settings = config_get_ptr();
x = settings->video.msg_pos_x;
y = settings->video.msg_pos_y;
scale = 1.0f;
@ -317,6 +313,7 @@ static void vita2d_font_render_msg(void *data, const char *msg,
}
max_glyphs = strlen(msg);
if (drop_x || drop_y)
max_glyphs *= 2;

View File

@ -261,15 +261,14 @@ static void vulkan_raster_font_flush(vulkan_raster_t *font)
static void vulkan_raster_font_render_msg(void *data, const char *msg,
const void *userdata)
{
float x, y, scale, drop_mod, drop_alpha;
float color[4], color_dark[4];
int drop_x, drop_y;
bool full_screen;
unsigned max_glyphs;
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;
settings_t *settings = config_get_ptr();
const struct font_params *params = (const struct font_params*)userdata;
if (!font || !msg || !*msg)
@ -300,6 +299,8 @@ static void vulkan_raster_font_render_msg(void *data, const char *msg,
}
else
{
settings_t *settings = config_get_ptr();
x = settings->video.msg_pos_x;
y = settings->video.msg_pos_y;
scale = 1.0f;

View File

@ -68,7 +68,6 @@ static void xfonts_render_msg(void *data, const char *msg,
{
wchar_t str[PATH_MAX_LENGTH];
float x, y;
settings_t *settings = config_get_ptr();
const struct font_params *params = (const struct font_params*)userdata;
xfonts_t *xfonts = (xfonts_t*)data;
@ -79,6 +78,8 @@ static void xfonts_render_msg(void *data, const char *msg,
}
else
{
settings_t *settings = config_get_ptr();
x = settings->video.msg_pos_x;
y = settings->video.msg_pos_y;
}

View File

@ -20,9 +20,10 @@
#include <boolean.h>
#include "../font_driver.h"
#include "bitmap.h"
#include "../font_driver.h"
#define BMP_ATLAS_COLS 16
#define BMP_ATLAS_ROWS 16
#define BMP_ATLAS_SIZE (BMP_ATLAS_COLS * BMP_ATLAS_ROWS)