(Font) Refactor font code to no longer use global

This commit is contained in:
twinaphex 2015-05-20 01:48:51 +02:00
parent 3d5abae2b9
commit 0bf3cf97e7
2 changed files with 15 additions and 7 deletions

View File

@ -264,14 +264,16 @@ static void gl_raster_font_render_message(
static void gl_raster_font_setup_viewport(gl_raster_t *font, bool full_screen)
{
unsigned width, height;
gl_t *gl = font->gl;
global_t *global = global_get_ptr();
if (!gl)
return;
video_driver_set_viewport(global->video_data.width,
global->video_data.height, full_screen, false);
video_driver_get_size(&width, &height);
video_driver_set_viewport(width, height, full_screen, false);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
@ -285,13 +287,15 @@ static void gl_raster_font_setup_viewport(gl_raster_t *font, bool full_screen)
static void gl_raster_font_restore_viewport(gl_t *gl)
{
unsigned width, height;
global_t *global = global_get_ptr();
video_driver_get_size(&width, &height);
glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]);
glDisable(GL_BLEND);
video_driver_set_viewport(global->video_data.width,
global->video_data.height, false, true);
video_driver_set_viewport(width, height, false, true);
}
static void gl_raster_font_render_msg(void *data, const char *msg,

View File

@ -34,18 +34,22 @@
static void *libdbg_font_init_font(void *gl_data, const char *font_path, float font_size)
{
global_t *global = global_get_ptr();
unsigned width, height;
video_driver_get_size(&width, &height);
(void)font_path;
(void)font_size;
(void)width;
(void)height;
DbgFontConfig cfg;
#if defined(SN_TARGET_PSP2)
cfg.fontSize = SCE_DBGFONT_FONTSIZE_LARGE;
#elif defined(__CELLOS_LV2__)
cfg.bufSize = SCE_DBGFONT_BUFSIZE_LARGE;
cfg.screenWidth = global->video_data.width;
cfg.screenHeight = global->video_data.height;
cfg.screenWidth = width;
cfg.screenHeight = height;
#endif
DbgFontInit(&cfg);