This commit is contained in:
twinaphex 2016-01-23 05:10:47 +01:00
parent df972d0fd5
commit a15f2519a5
1 changed files with 15 additions and 7 deletions

View File

@ -118,7 +118,8 @@ static bool gl_raster_font_upload_atlas(gl_raster_t *font,
} }
break; break;
default: default:
RARCH_ERR("Unsupported number of components: %u\n", (unsigned)ncomponents); RARCH_ERR("Unsupported number of components: %u\n",
(unsigned)ncomponents);
free(tmp); free(tmp);
return false; return false;
} }
@ -162,7 +163,8 @@ static void *gl_raster_font_init_font(void *data,
font->tex_width = next_pow2(atlas->width);; font->tex_width = next_pow2(atlas->width);;
font->tex_height = next_pow2(atlas->height);; font->tex_height = next_pow2(atlas->height);;
if (!gl_raster_font_upload_atlas(font, atlas, font->tex_width, font->tex_height)) if (!gl_raster_font_upload_atlas(font, atlas,
font->tex_width, font->tex_height))
goto error; goto error;
glBindTexture(GL_TEXTURE_2D, font->gl->texture[font->gl->tex_index]); glBindTexture(GL_TEXTURE_2D, font->gl->texture[font->gl->tex_index]);
@ -189,7 +191,8 @@ static void gl_raster_font_free_font(void *data)
free(font); free(font);
} }
static int gl_get_message_width(void *data, const char *msg, unsigned msg_len_full, float scale) static int gl_get_message_width(void *data, const char *msg,
unsigned msg_len_full, float scale)
{ {
gl_raster_t *font = (gl_raster_t*)data; gl_raster_t *font = (gl_raster_t*)data;
@ -333,11 +336,13 @@ static void gl_raster_font_render_message(
/* If the font height is not supported just draw as usual */ /* If the font height is not supported just draw as usual */
if (!font->font_driver->get_line_height) if (!font->font_driver->get_line_height)
{ {
gl_raster_font_render_line(font, msg, strlen(msg), scale, color, pos_x, pos_y, text_align); gl_raster_font_render_line(font, msg, strlen(msg),
scale, color, pos_x, pos_y, text_align);
return; return;
} }
line_height = scale * 1/(float)font->font_driver->get_line_height(font->font_data); line_height = scale * 1/ (float)
font->font_driver->get_line_height(font->font_data);
for (;;) for (;;)
{ {
@ -347,14 +352,17 @@ static void gl_raster_font_render_message(
if (delim) if (delim)
{ {
unsigned msg_len = delim - msg; unsigned msg_len = delim - msg;
gl_raster_font_render_line(font, msg, msg_len, scale, color, pos_x, pos_y - (float)lines*line_height, text_align); gl_raster_font_render_line(font,
msg, msg_len, scale, color, pos_x,
pos_y - (float)lines*line_height, text_align);
msg += msg_len + 1; msg += msg_len + 1;
lines++; lines++;
} }
else else
{ {
unsigned msg_len = strlen(msg); unsigned msg_len = strlen(msg);
gl_raster_font_render_line(font, msg, msg_len, scale, color, pos_x, pos_y - (float)lines*line_height, text_align); gl_raster_font_render_line(font, msg, msg_len, scale, color, pos_x,
pos_y - (float)lines*line_height, text_align);
break; break;
} }
} }