From ca0a5b9f76bb19be8423e984b6d65920950bcaf5 Mon Sep 17 00:00:00 2001 From: Themaister Date: Sun, 27 May 2012 02:04:50 +0200 Subject: [PATCH] Move font stuff to gfx/fonts. --- Makefile | 4 +-- Makefile.win | 4 +-- gfx/context/ps3_ctx.c | 16 +++------- gfx/ext_gfx.c | 2 +- gfx/{ => fonts}/fonts.c | 2 +- gfx/{ => fonts}/fonts.h | 0 .../font_freetype_ctx.c => fonts/freetype.c} | 6 ++-- .../ps3_libdbgfont.c} | 5 +-- gfx/gl.c | 3 +- gfx/gl_common.h | 2 +- gfx/gl_font.c | 32 ------------------- gfx/sdl_gfx.c | 2 +- gfx/xvideo.c | 2 +- 13 files changed, 21 insertions(+), 59 deletions(-) rename gfx/{ => fonts}/fonts.c (99%) rename gfx/{ => fonts}/fonts.h (100%) rename gfx/{context/font_freetype_ctx.c => fonts/freetype.c} (98%) rename gfx/{context/font_ps3_libdgbfont_ctx.c => fonts/ps3_libdbgfont.c} (92%) delete mode 100644 gfx/gl_font.c diff --git a/Makefile b/Makefile index b2ea0a09a9..60f3f787d3 100644 --- a/Makefile +++ b/Makefile @@ -105,7 +105,7 @@ ifeq ($(HAVE_SDL), 1) LIBS += $(SDL_LIBS) ifeq ($(HAVE_OPENGL), 1) - OBJ += gfx/gl.o gfx/gl_font.o gfx/context/font_freetype_ctx.o + OBJ += gfx/gl.o gfx/fonts/freetype.o ifeq ($(OSX),1) LIBS += -framework OpenGL else @@ -147,7 +147,7 @@ ifeq ($(HAVE_DYLIB), 1) endif ifeq ($(HAVE_FREETYPE), 1) - OBJ += gfx/fonts.o + OBJ += gfx/fonts/fonts.o LIBS += $(FREETYPE_LIBS) DEFINES += $(FREETYPE_CFLAGS) endif diff --git a/Makefile.win b/Makefile.win index 9782ef8a81..3273443b52 100644 --- a/Makefile.win +++ b/Makefile.win @@ -39,7 +39,7 @@ ifeq ($(TDM_GCC),) endif ifeq ($(HAVE_SDL), 1) - OBJ += gfx/sdl_gfx.o gfx/gl.o gfx/gl_font.o gfx/context/sdl_ctx.o input/sdl_input.o audio/sdl_audio.o fifo_buffer.o + OBJ += gfx/sdl_gfx.o gfx/gl.o gfx/fonts/freetype.o gfx/context/sdl_ctx.o input/sdl_input.o audio/sdl_audio.o fifo_buffer.o LIBS += -lSDL DEFINES += -ISDL -DHAVE_SDL endif @@ -100,7 +100,7 @@ ifeq ($(HAVE_NETPLAY), 1) endif ifeq ($(HAVE_FREETYPE), 1) - OBJ += gfx/fonts.o + OBJ += gfx/fonts/fonts.o DEFINES += -DHAVE_FREETYPE -Ifreetype2 LIBS += -lfreetype -lz endif diff --git a/gfx/context/ps3_ctx.c b/gfx/context/ps3_ctx.c index 98ff177ec0..919b9e159e 100644 --- a/gfx/context/ps3_ctx.c +++ b/gfx/context/ps3_ctx.c @@ -28,37 +28,30 @@ void gfx_ctx_set_swap_interval(unsigned interval, bool inited) { - bool success = false; - - if(inited) + if (inited) { - success = true; - if (interval) glEnable(GL_VSYNC_SCE); else glDisable(GL_VSYNC_SCE); } - - if (!success) - RARCH_WARN("Failed to set swap interval.\n"); } void gfx_ctx_check_window(bool *quit, bool *resize, unsigned *width, unsigned *height, unsigned frame_count) { + gl_t *gl = driver.video_data; *quit = false; *resize = false; - gl_t *gl = driver.video_data; #ifdef HAVE_SYSUTILS cellSysutilCheckCallback(); #endif - if(gl->quitting) + if (gl->quitting) *quit = true; - if(gl->should_resize) + if (gl->should_resize) *resize = true; } @@ -66,3 +59,4 @@ bool gfx_ctx_window_has_focus(void) { return true; } + diff --git a/gfx/ext_gfx.c b/gfx/ext_gfx.c index 574e98c29a..6f917bf0a3 100644 --- a/gfx/ext_gfx.c +++ b/gfx/ext_gfx.c @@ -25,7 +25,7 @@ #include "gfx_common.h" #ifdef HAVE_FREETYPE -#include "fonts.h" +#include "fonts/fonts.h" #endif #ifdef HAVE_PYTHON diff --git a/gfx/fonts.c b/gfx/fonts/fonts.c similarity index 99% rename from gfx/fonts.c rename to gfx/fonts/fonts.c index 98554056b6..c027a7133f 100644 --- a/gfx/fonts.c +++ b/gfx/fonts/fonts.c @@ -14,7 +14,7 @@ */ #include "fonts.h" -#include "../file.h" +#include "../../file.h" #include #include #include diff --git a/gfx/fonts.h b/gfx/fonts/fonts.h similarity index 100% rename from gfx/fonts.h rename to gfx/fonts/fonts.h diff --git a/gfx/context/font_freetype_ctx.c b/gfx/fonts/freetype.c similarity index 98% rename from gfx/context/font_freetype_ctx.c rename to gfx/fonts/freetype.c index e47a730d7c..53e5557414 100644 --- a/gfx/context/font_freetype_ctx.c +++ b/gfx/fonts/freetype.c @@ -16,7 +16,7 @@ #include "../gl_common.h" -void gl_init_font_ctx(gl_t *gl, const char *font_path, unsigned font_size) +void gl_init_font(gl_t *gl, const char *font_path, unsigned font_size) { #ifdef HAVE_FREETYPE if (!g_settings.video.font_enable) @@ -66,7 +66,7 @@ void gl_init_font_ctx(gl_t *gl, const char *font_path, unsigned font_size) #endif } -void gl_deinit_font_ctx(gl_t *gl) +void gl_deinit_font(gl_t *gl) { #ifdef HAVE_FREETYPE if (gl->font) @@ -221,7 +221,7 @@ static void calculate_font_coords(gl_t *gl, } #endif -void gl_render_msg_ctx(gl_t *gl, const char *msg) +void gl_render_msg(gl_t *gl, const char *msg) { #ifdef HAVE_FREETYPE if (!gl->font) diff --git a/gfx/context/font_ps3_libdgbfont_ctx.c b/gfx/fonts/ps3_libdbgfont.c similarity index 92% rename from gfx/context/font_ps3_libdgbfont_ctx.c rename to gfx/fonts/ps3_libdbgfont.c index 0a791a6272..9677153221 100644 --- a/gfx/context/font_ps3_libdgbfont_ctx.c +++ b/gfx/fonts/ps3_libdbgfont.c @@ -23,13 +23,14 @@ void gl_init_font(gl_t *gl, const char *font_path, unsigned font_size) (void)font_size; } -void gl_deinit_font_ctx(gl_t *gl) +void gl_deinit_font(gl_t *gl) { (void)gl; } -void gl_render_msg_ctx(gl_t *gl, const char *msg) +void gl_render_msg(gl_t *gl, const char *msg) { (void)gl; (void)msg; } + diff --git a/gfx/gl.c b/gfx/gl.c index e97069cf70..d76a2f1d88 100644 --- a/gfx/gl.c +++ b/gfx/gl.c @@ -46,9 +46,8 @@ #include "shader_glsl.h" #endif - #ifdef HAVE_FREETYPE -#include "fonts.h" +#include "fonts/fonts.h" #endif // Used for the last pass when rendering to the back buffer. diff --git a/gfx/gl_common.h b/gfx/gl_common.h index 9fff4ad516..faed0c34c7 100644 --- a/gfx/gl_common.h +++ b/gfx/gl_common.h @@ -17,7 +17,7 @@ #define __GL_COMMON_H #include "../general.h" -#include "fonts.h" +#include "fonts/fonts.h" #ifdef HAVE_CONFIG_H #include "../config.h" diff --git a/gfx/gl_font.c b/gfx/gl_font.c deleted file mode 100644 index d6ce066d70..0000000000 --- a/gfx/gl_font.c +++ /dev/null @@ -1,32 +0,0 @@ -/* RetroArch - A frontend for libretro. - * Copyright (C) 2010-2012 - Hans-Kristian Arntzen - * - * RetroArch is free software: you can redistribute it and/or modify it under the terms - * of the GNU General Public License as published by the Free Software Found- - * ation, either version 3 of the License, or (at your option) any later version. - * - * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with RetroArch. - * If not, see . - */ - -#include "gl_font.h" - -void gl_init_font(gl_t *gl, const char *font_path, unsigned font_size) -{ - gl_init_font_ctx(gl, font_path, font_size); -} - -void gl_deinit_font(gl_t *gl) -{ - gl_deinit_font_ctx(gl); -} - - -void gl_render_msg(gl_t *gl, const char *msg) -{ - gl_render_msg_ctx(gl, msg); -} diff --git a/gfx/sdl_gfx.c b/gfx/sdl_gfx.c index 93cbd3ce24..64dddcc882 100644 --- a/gfx/sdl_gfx.c +++ b/gfx/sdl_gfx.c @@ -26,7 +26,7 @@ #endif #ifdef HAVE_FREETYPE -#include "fonts.h" +#include "fonts/fonts.h" #endif static void convert_15bit_15bit_direct(uint16_t *out, unsigned outpitch, const uint16_t *input, unsigned width, unsigned height, unsigned pitch, const SDL_PixelFormat *fmt); diff --git a/gfx/xvideo.c b/gfx/xvideo.c index f86e316cf9..362a6df4a9 100644 --- a/gfx/xvideo.c +++ b/gfx/xvideo.c @@ -20,7 +20,7 @@ #include #include #ifdef HAVE_FREETYPE -#include "fonts.h" +#include "fonts/fonts.h" #endif #include "gfx_common.h"