From 867bdad010c6d6b70eef5f0274562ff27641bb91 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 9 Mar 2020 22:13:17 +0100 Subject: [PATCH] Get rid of unimplemented FPGA font driver --- Makefile.common | 3 +- gfx/drivers/fpga_gfx.c | 15 ---- gfx/drivers_font/fpga_font.c | 148 ----------------------------------- gfx/font_driver.h | 1 - gfx/video_defines.h | 1 - 5 files changed, 1 insertion(+), 167 deletions(-) delete mode 100644 gfx/drivers_font/fpga_font.c diff --git a/Makefile.common b/Makefile.common index b71a3b3b29..5ca4bad1c7 100644 --- a/Makefile.common +++ b/Makefile.common @@ -1937,8 +1937,7 @@ endif ifneq ($(findstring FPGA,$(OS)),) OBJ += gfx/drivers/fpga_gfx.o \ - gfx/drivers_context/fpga_ctx.o \ - gfx/drivers_font/fpga_font.o + gfx/drivers_context/fpga_ctx.o endif ifneq ($(findstring Win32,$(OS)),) diff --git a/gfx/drivers/fpga_gfx.c b/gfx/drivers/fpga_gfx.c index 6b31f9fbef..3d63f89117 100644 --- a/gfx/drivers/fpga_gfx.c +++ b/gfx/drivers/fpga_gfx.c @@ -29,8 +29,6 @@ #include "../../menu/menu_driver.h" #endif -#include "../font_driver.h" - #include "../../driver.h" #include "../../configuration.h" #include "../../verbosity.h" @@ -112,7 +110,6 @@ static void *fpga_gfx_init(const video_info_t *video, unsigned win_width = 0, win_height = 0; unsigned temp_width = 0, temp_height = 0; settings_t *settings = config_get_ptr(); - bool video_font_enable = settings->bools.video_font_enable; fpga_t *fpga = (fpga_t*)calloc(1, sizeof(*fpga)); *input = NULL; @@ -190,13 +187,6 @@ static void *fpga_gfx_init(const video_info_t *video, video_context_driver_input_driver(&inp); - if (video_font_enable) - font_driver_init_osd(NULL, - video, - false, - video->is_threaded, - FONT_DRIVER_RENDER_FPGA); - RARCH_LOG("[FPGA]: Init complete.\n"); return fpga; @@ -319,9 +309,6 @@ static bool fpga_gfx_frame(void *data, const void *frame, } } - if (msg) - font_driver_render_msg(fpga, video_info, msg, NULL, NULL); - return true; } @@ -381,7 +368,6 @@ static void fpga_gfx_free(void *data) free(fpga->menu_frame); fpga->menu_frame = NULL; - font_driver_free_osd(); video_context_driver_free(); free(fpga); @@ -460,7 +446,6 @@ static void fpga_set_osd_msg(void *data, const char *msg, const void *params, void *font) { - font_driver_render_msg(data, video_info, msg, params, font); } static void fpga_get_video_output_size(void *data, diff --git a/gfx/drivers_font/fpga_font.c b/gfx/drivers_font/fpga_font.c deleted file mode 100644 index d89757b507..0000000000 --- a/gfx/drivers_font/fpga_font.c +++ /dev/null @@ -1,148 +0,0 @@ -/* RetroArch - A frontend for libretro. - * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2017 - Daniel De Matteis - * Copyright (C) 2016-2017 - Brad Parker - * - * 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 -#include -#include - -#ifdef HAVE_CONFIG_H -#include "../../config.h" -#endif - -#include "../common/fpga_common.h" - -#include "../font_driver.h" -#include "../video_driver.h" -#include "../../configuration.h" -#include "../../verbosity.h" - -typedef struct -{ - const font_renderer_driver_t *fpga_font_driver; - void *fpga_font_data; - fpga_t *fpga; -} fpga_raster_t; - -static void *fpga_init_font(void *data, - const char *font_path, float font_size, - bool is_threaded) -{ - fpga_raster_t *font = (fpga_raster_t*)calloc(1, sizeof(*font)); - - if (!font) - return NULL; - - font->fpga = (fpga_t*)data; - - font_size = 1; - - if (!font_renderer_create_default((const void**)&font->fpga_font_driver, - &font->fpga_font_data, font_path, font_size)) - { - RARCH_WARN("Couldn't initialize font renderer.\n"); - return NULL; - } - - return font; -} - -static void fpga_render_free_font(void *data, bool is_threaded) -{ - (void)data; - (void)is_threaded; -} - -static int fpga_get_message_width(void *data, const char *msg, - unsigned msg_len, float scale) -{ - return 0; -} - -static const struct font_glyph *fpga_font_get_glyph( - void *data, uint32_t code) -{ - return NULL; -} - -static void fpga_render_msg( - void *userdata, - video_frame_info_t *video_info, - void *data, const char *msg, - const void *_params) -{ - float x, y, scale; - unsigned newX, newY, len; - unsigned align; - fpga_raster_t *font = (fpga_raster_t*)data; - const struct font_params *params = (const struct font_params*)_params; - unsigned width = video_info->width; - unsigned height = video_info->height; - settings_t *settings = config_get_ptr(); - float video_msg_pos_x = settings->floats.video_msg_pos_x; - float video_msg_pos_y = settings->floats.video_msg_pos_y; - - if (!font || string_is_empty(msg)) - return; - - if (params) - { - x = params->x; - y = params->y; - scale = params->scale; - align = params->text_align; - } - else - { - x = video_msg_pos_x; - y = video_msg_pos_y; - scale = 1.0f; - align = TEXT_ALIGN_LEFT; - } - - if (!font->fpga) - return; - - len = utf8len(msg); - - switch (align) - { - case TEXT_ALIGN_LEFT: - newX = x * width * scale; - break; - case TEXT_ALIGN_RIGHT: - newX = (x * width * scale) - len; - break; - case TEXT_ALIGN_CENTER: - newX = (x * width * scale) - (len / 2); - break; - default: - break; - } - - /* TODO: draw osd msg */ -} - -font_renderer_t fpga_font = { - fpga_init_font, - fpga_render_free_font, - fpga_render_msg, - "fpga font", - fpga_font_get_glyph, /* get_glyph */ - NULL, /* bind_block */ - NULL, /* flush */ - fpga_get_message_width /* get_message_width */ -}; diff --git a/gfx/font_driver.h b/gfx/font_driver.h index 8272cd73d5..30933cb8ed 100644 --- a/gfx/font_driver.h +++ b/gfx/font_driver.h @@ -179,7 +179,6 @@ extern font_renderer_t d3d12_font; extern font_renderer_t caca_font; extern font_renderer_t gdi_font; extern font_renderer_t vga_font; -extern font_renderer_t fpga_font; extern font_renderer_t sixel_font; extern font_renderer_t switch_font; diff --git a/gfx/video_defines.h b/gfx/video_defines.h index d05f38b257..2a1dd62a39 100644 --- a/gfx/video_defines.h +++ b/gfx/video_defines.h @@ -102,7 +102,6 @@ enum font_driver_render_api FONT_DRIVER_RENDER_NETWORK_VIDEO, FONT_DRIVER_RENDER_GDI, FONT_DRIVER_RENDER_VGA, - FONT_DRIVER_RENDER_FPGA, FONT_DRIVER_RENDER_SWITCH };