mirror of
https://github.com/libretro/RetroArch
synced 2025-04-16 08:43:10 +00:00
(Font drivers) Simplifications
This commit is contained in:
parent
9cb4d924cb
commit
67898f5d12
@ -334,26 +334,19 @@ static void ctr_font_render_message(
|
|||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
const char* delim = strchr(msg, '\n');
|
const char* delim = strchr(msg, '\n');
|
||||||
|
unsigned msg_len = delim ?
|
||||||
|
(unsigned)(delim - msg) : strlen(msg);
|
||||||
|
|
||||||
/* Draw the line */
|
/* Draw the line */
|
||||||
if (delim)
|
|
||||||
{
|
|
||||||
unsigned msg_len = delim - msg;
|
|
||||||
ctr_font_render_line(ctr, font, msg, msg_len,
|
ctr_font_render_line(ctr, font, msg, msg_len,
|
||||||
scale, color, pos_x, pos_y - (float)lines * line_height,
|
scale, color, pos_x, pos_y - (float)lines * line_height,
|
||||||
width, height, text_align);
|
width, height, text_align);
|
||||||
|
if (!delim)
|
||||||
|
break;
|
||||||
|
|
||||||
msg += msg_len + 1;
|
msg += msg_len + 1;
|
||||||
lines++;
|
lines++;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
unsigned msg_len = strlen(msg);
|
|
||||||
ctr_font_render_line(ctr, font, msg, msg_len,
|
|
||||||
scale, color, pos_x, pos_y - (float)lines * line_height,
|
|
||||||
width, height, text_align);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ctr_font_render_msg(
|
static void ctr_font_render_msg(
|
||||||
|
@ -259,28 +259,21 @@ static void d3d10_font_render_message(
|
|||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
const char* delim = strchr(msg, '\n');
|
const char* delim = strchr(msg, '\n');
|
||||||
|
unsigned msg_len = delim ?
|
||||||
|
(unsigned)(delim - msg) : strlen(msg);
|
||||||
|
|
||||||
/* Draw the line */
|
/* Draw the line */
|
||||||
if (delim)
|
|
||||||
{
|
|
||||||
unsigned msg_len = delim - msg;
|
|
||||||
d3d10_font_render_line(d3d10,
|
d3d10_font_render_line(d3d10,
|
||||||
font, msg, msg_len, scale, color, pos_x,
|
font, msg, msg_len, scale, color, pos_x,
|
||||||
pos_y - (float)lines * line_height,
|
pos_y - (float)lines * line_height,
|
||||||
width, height, text_align);
|
width, height, text_align);
|
||||||
|
|
||||||
|
if (!delim)
|
||||||
|
break;
|
||||||
|
|
||||||
msg += msg_len + 1;
|
msg += msg_len + 1;
|
||||||
lines++;
|
lines++;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
unsigned msg_len = strlen(msg);
|
|
||||||
d3d10_font_render_line(d3d10,
|
|
||||||
font, msg, msg_len, scale, color, pos_x,
|
|
||||||
pos_y - (float)lines * line_height,
|
|
||||||
width, height, text_align);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void d3d10_font_render_msg(
|
static void d3d10_font_render_msg(
|
||||||
|
@ -256,28 +256,21 @@ static void d3d11_font_render_message(
|
|||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
const char* delim = strchr(msg, '\n');
|
const char* delim = strchr(msg, '\n');
|
||||||
|
unsigned msg_len = delim ?
|
||||||
|
(unsigned)(delim - msg) : strlen(msg);
|
||||||
|
|
||||||
/* Draw the line */
|
/* Draw the line */
|
||||||
if (delim)
|
|
||||||
{
|
|
||||||
unsigned msg_len = delim - msg;
|
|
||||||
d3d11_font_render_line(d3d11,
|
d3d11_font_render_line(d3d11,
|
||||||
font, msg, msg_len, scale, color, pos_x,
|
font, msg, msg_len, scale, color, pos_x,
|
||||||
pos_y - (float)lines * line_height,
|
pos_y - (float)lines * line_height,
|
||||||
width, height, text_align);
|
width, height, text_align);
|
||||||
|
|
||||||
|
if (!delim)
|
||||||
|
break;
|
||||||
|
|
||||||
msg += msg_len + 1;
|
msg += msg_len + 1;
|
||||||
lines++;
|
lines++;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
unsigned msg_len = strlen(msg);
|
|
||||||
d3d11_font_render_line(d3d11,
|
|
||||||
font, msg, msg_len, scale, color, pos_x,
|
|
||||||
pos_y - (float)lines * line_height,
|
|
||||||
width, height, text_align);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void d3d11_font_render_msg(
|
static void d3d11_font_render_msg(
|
||||||
|
@ -270,26 +270,20 @@ static void d3d12_font_render_message(
|
|||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
const char* delim = strchr(msg, '\n');
|
const char* delim = strchr(msg, '\n');
|
||||||
|
unsigned msg_len = delim ?
|
||||||
|
(unsigned)(delim - msg) : strlen(msg);
|
||||||
|
|
||||||
/* Draw the line */
|
/* Draw the line */
|
||||||
if (delim)
|
|
||||||
{
|
|
||||||
unsigned msg_len = delim - msg;
|
|
||||||
d3d12_font_render_line(d3d12,
|
d3d12_font_render_line(d3d12,
|
||||||
font, msg, msg_len, scale, color, pos_x,
|
font, msg, msg_len, scale, color, pos_x,
|
||||||
pos_y - (float)lines * line_height, width, height, text_align);
|
pos_y - (float)lines * line_height, width, height, text_align);
|
||||||
|
|
||||||
|
if (!delim)
|
||||||
|
break;
|
||||||
|
|
||||||
msg += msg_len + 1;
|
msg += msg_len + 1;
|
||||||
lines++;
|
lines++;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
unsigned msg_len = strlen(msg);
|
|
||||||
d3d12_font_render_line(d3d12,
|
|
||||||
font, msg, msg_len, scale, color, pos_x,
|
|
||||||
pos_y - (float)lines * line_height, width, height, text_align);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void d3d12_font_render_msg(
|
static void d3d12_font_render_msg(
|
||||||
|
@ -366,11 +366,10 @@ static INLINE void write_quad6(SpriteVertex *pv,
|
|||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
const char *delim = strchr(msg, '\n');
|
const char *delim = strchr(msg, '\n');
|
||||||
|
NSUInteger msg_len = delim ?
|
||||||
|
(unsigned)(delim - msg) : strlen(msg);
|
||||||
|
|
||||||
/* Draw the line */
|
/* Draw the line */
|
||||||
if (delim)
|
|
||||||
{
|
|
||||||
NSUInteger msg_len = delim - msg;
|
|
||||||
[self _renderLine:msg
|
[self _renderLine:msg
|
||||||
length:msg_len
|
length:msg_len
|
||||||
scale:scale
|
scale:scale
|
||||||
@ -378,22 +377,13 @@ static INLINE void write_quad6(SpriteVertex *pv,
|
|||||||
posX:posX
|
posX:posX
|
||||||
posY:posY - (float)lines * line_height
|
posY:posY - (float)lines * line_height
|
||||||
aligned:aligned];
|
aligned:aligned];
|
||||||
|
|
||||||
|
if (!delim)
|
||||||
|
break;
|
||||||
|
|
||||||
msg += msg_len + 1;
|
msg += msg_len + 1;
|
||||||
lines++;
|
lines++;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
NSUInteger msg_len = strlen(msg);
|
|
||||||
[self _renderLine:msg
|
|
||||||
length:msg_len
|
|
||||||
scale:scale
|
|
||||||
color:color
|
|
||||||
posX:posX
|
|
||||||
posY:posY - (float)lines * line_height
|
|
||||||
aligned:aligned];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)renderMessage:(const char *)msg
|
- (void)renderMessage:(const char *)msg
|
||||||
|
@ -197,7 +197,7 @@ static void switch_font_render_message(
|
|||||||
int lines = 0;
|
int lines = 0;
|
||||||
float line_height;
|
float line_height;
|
||||||
|
|
||||||
if (!msg || !*msg)
|
if (!msg || !*msg || !sw)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* If font line metrics are not supported just draw as usual */
|
/* If font line metrics are not supported just draw as usual */
|
||||||
@ -218,34 +218,21 @@ static void switch_font_render_message(
|
|||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
const char *delim = strchr(msg, '\n');
|
const char *delim = strchr(msg, '\n');
|
||||||
|
unsigned msg_len = delim ?
|
||||||
|
(unsigned)(delim - msg) : strlen(msg);
|
||||||
|
|
||||||
/* Draw the line */
|
/* Draw the line */
|
||||||
if (delim)
|
|
||||||
{
|
|
||||||
unsigned msg_len = delim - msg;
|
|
||||||
if (msg_len <= AVG_GLPYH_LIMIT)
|
if (msg_len <= AVG_GLPYH_LIMIT)
|
||||||
{
|
|
||||||
if (sw)
|
|
||||||
switch_font_render_line(sw, font, msg, msg_len,
|
switch_font_render_line(sw, font, msg, msg_len,
|
||||||
scale, color, pos_x, pos_y - (float)lines * line_height,
|
scale, color, pos_x, pos_y - (float)lines * line_height,
|
||||||
text_align);
|
text_align);
|
||||||
}
|
|
||||||
|
if (!delim)
|
||||||
|
break;
|
||||||
|
|
||||||
msg += msg_len + 1;
|
msg += msg_len + 1;
|
||||||
lines++;
|
lines++;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
unsigned msg_len = strlen(msg);
|
|
||||||
if (msg_len <= AVG_GLPYH_LIMIT)
|
|
||||||
{
|
|
||||||
if (sw)
|
|
||||||
switch_font_render_line(sw, font, msg, msg_len,
|
|
||||||
scale, color, pos_x, pos_y - (float)lines * line_height,
|
|
||||||
text_align);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void switch_font_render_msg(
|
static void switch_font_render_msg(
|
||||||
|
@ -246,13 +246,14 @@ static void vita2d_font_render_message(
|
|||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
const char *delim = strchr(msg, '\n');
|
const char *delim = strchr(msg, '\n');
|
||||||
unsigned msg_len = (delim) ? (delim - msg) : strlen(msg);
|
unsigned msg_len = (delim) ?
|
||||||
|
(unsigned)(delim - msg) : strlen(msg);
|
||||||
|
|
||||||
|
/* Draw the line */
|
||||||
vita2d_font_render_line(font, msg, msg_len,
|
vita2d_font_render_line(font, msg, msg_len,
|
||||||
scale, color, pos_x, pos_y - (float)lines * line_height,
|
scale, color, pos_x, pos_y - (float)lines * line_height,
|
||||||
width, height, text_align);
|
width, height, text_align);
|
||||||
|
|
||||||
/* Draw the line */
|
|
||||||
if (!delim)
|
if (!delim)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -244,7 +244,6 @@ static void vulkan_raster_font_render_message(
|
|||||||
if (!font->font_driver->get_line_metrics ||
|
if (!font->font_driver->get_line_metrics ||
|
||||||
!font->font_driver->get_line_metrics(font->font_data, &line_metrics))
|
!font->font_driver->get_line_metrics(font->font_data, &line_metrics))
|
||||||
{
|
{
|
||||||
if (font->vk)
|
|
||||||
vulkan_raster_font_render_line(font, msg, strlen(msg),
|
vulkan_raster_font_render_line(font, msg, strlen(msg),
|
||||||
scale, color, pos_x, pos_y, text_align);
|
scale, color, pos_x, pos_y, text_align);
|
||||||
return;
|
return;
|
||||||
@ -255,28 +254,20 @@ static void vulkan_raster_font_render_message(
|
|||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
const char *delim = strchr(msg, '\n');
|
const char *delim = strchr(msg, '\n');
|
||||||
|
unsigned msg_len = delim
|
||||||
|
? (unsigned)(delim - msg) : (unsigned)strlen(msg);
|
||||||
|
|
||||||
/* Draw the line */
|
/* Draw the line */
|
||||||
if (delim)
|
|
||||||
{
|
|
||||||
unsigned msg_len = delim - msg;
|
|
||||||
if (font->vk)
|
|
||||||
vulkan_raster_font_render_line(font, msg, msg_len,
|
vulkan_raster_font_render_line(font, msg, msg_len,
|
||||||
scale, color, pos_x, pos_y - (float)lines * line_height,
|
scale, color, pos_x, pos_y - (float)lines * line_height,
|
||||||
text_align);
|
text_align);
|
||||||
|
|
||||||
|
if (!delim)
|
||||||
|
break;
|
||||||
|
|
||||||
msg += msg_len + 1;
|
msg += msg_len + 1;
|
||||||
lines++;
|
lines++;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
unsigned msg_len = strlen(msg);
|
|
||||||
if (font->vk)
|
|
||||||
vulkan_raster_font_render_line(font, msg, msg_len,
|
|
||||||
scale, color, pos_x, pos_y - (float)lines * line_height,
|
|
||||||
text_align);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void vulkan_raster_font_flush(vulkan_raster_t *font)
|
static void vulkan_raster_font_flush(vulkan_raster_t *font)
|
||||||
|
@ -263,26 +263,20 @@ static void wiiu_font_render_message(
|
|||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
const char* delim = strchr(msg, '\n');
|
const char* delim = strchr(msg, '\n');
|
||||||
|
unsigned msg_len = delim ?
|
||||||
|
(unsigned)(delim - msg) : strlen(msg);
|
||||||
|
|
||||||
/* Draw the line */
|
/* Draw the line */
|
||||||
if (delim)
|
|
||||||
{
|
|
||||||
unsigned msg_len = delim - msg;
|
|
||||||
wiiu_font_render_line(wiiu, font, msg, msg_len,
|
wiiu_font_render_line(wiiu, font, msg, msg_len,
|
||||||
scale, color, pos_x, pos_y - (float)lines * line_height,
|
scale, color, pos_x, pos_y - (float)lines * line_height,
|
||||||
width, height, text_align);
|
width, height, text_align);
|
||||||
|
|
||||||
|
if (!delim)
|
||||||
|
break;
|
||||||
|
|
||||||
msg += msg_len + 1;
|
msg += msg_len + 1;
|
||||||
lines++;
|
lines++;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
unsigned msg_len = strlen(msg);
|
|
||||||
wiiu_font_render_line(wiiu, font, msg, msg_len,
|
|
||||||
scale, color, pos_x, pos_y - (float)lines * line_height,
|
|
||||||
width, height, text_align);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wiiu_font_render_msg(
|
static void wiiu_font_render_msg(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user