mirror of
https://github.com/libretro/RetroArch
synced 2025-03-08 19:14:33 +00:00
Pass video_info pointer to font drivers
This commit is contained in:
parent
eea139ca30
commit
e0ff0541a2
@ -154,7 +154,7 @@ static bool caca_gfx_frame(void *data, const void *frame,
|
||||
#endif
|
||||
|
||||
if (msg)
|
||||
font_driver_render_msg(NULL, msg, NULL);
|
||||
font_driver_render_msg(video_info, NULL, msg, NULL);
|
||||
|
||||
if (draw)
|
||||
{
|
||||
@ -291,9 +291,11 @@ static void caca_set_texture_frame(void *data,
|
||||
}
|
||||
|
||||
static void caca_set_osd_msg(void *data, const char *msg,
|
||||
const struct font_params *params, void *font)
|
||||
const void *params, void *font)
|
||||
{
|
||||
font_driver_render_msg(font, msg, params);
|
||||
video_frame_info_t video_info;
|
||||
video_driver_build_info(&video_info);
|
||||
font_driver_render_msg(&video_info, font, msg, params);
|
||||
}
|
||||
|
||||
static const video_poke_interface_t caca_poke_interface = {
|
||||
|
@ -445,6 +445,10 @@ static void* ctr_init(const video_info_t* video,
|
||||
return ctr;
|
||||
}
|
||||
|
||||
#if 0
|
||||
#define CTR_INSPECT_MEMORY_USAGE
|
||||
#endif
|
||||
|
||||
static bool ctr_frame(void* data, const void* frame,
|
||||
unsigned width, unsigned height,
|
||||
uint64_t frame_count,
|
||||
@ -519,12 +523,16 @@ static bool ctr_frame(void* data, const void* frame,
|
||||
#ifndef HAVE_THREADS
|
||||
if(task_queue_ctl(TASK_QUEUE_CTL_FIND, &ctr_tasks_finder_data))
|
||||
{
|
||||
// ctr->vsync_event_pending = true;
|
||||
#if 0
|
||||
ctr->vsync_event_pending = true;
|
||||
#endif
|
||||
while(ctr->vsync_event_pending)
|
||||
{
|
||||
task_queue_ctl(TASK_QUEUE_CTL_CHECK, NULL);
|
||||
svcSleepThread(0);
|
||||
// aptMainLoop();
|
||||
#if 0
|
||||
aptMainLoop();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -542,7 +550,6 @@ static bool ctr_frame(void* data, const void* frame,
|
||||
frames = 0;
|
||||
}
|
||||
|
||||
//#define CTR_INSPECT_MEMORY_USAGE
|
||||
|
||||
#ifdef CTR_INSPECT_MEMORY_USAGE
|
||||
uint32_t ctr_get_stack_usage(void);
|
||||
@ -562,12 +569,14 @@ static bool ctr_frame(void* data, const void* frame,
|
||||
if(query_addr == 0x1F000000)
|
||||
query_addr = 0x30000000;
|
||||
}
|
||||
// static u32* dummy_pointer;
|
||||
// if(total_frames == 500)
|
||||
// dummy_pointer = malloc(0x2000000);
|
||||
// if(total_frames == 1000)
|
||||
// free(dummy_pointer);
|
||||
|
||||
#if 0
|
||||
static u32* dummy_pointer;
|
||||
if(total_frames == 500)
|
||||
dummy_pointer = malloc(0x2000000);
|
||||
if(total_frames == 1000)
|
||||
free(dummy_pointer);
|
||||
#endif
|
||||
|
||||
printf("========================================");
|
||||
printf("0x%08X 0x%08X 0x%08X\n", __heap_size, gpuCmdBufOffset, (__linear_heap_size - linearSpaceFree()));
|
||||
@ -620,10 +629,12 @@ static bool ctr_frame(void* data, const void* frame,
|
||||
&& (pitch > 0x40))
|
||||
{
|
||||
/* can copy the buffer directly with the GPU */
|
||||
// GSPGPU_FlushDataCache(frame, pitch * height);
|
||||
#if 0
|
||||
GSPGPU_FlushDataCache(frame, pitch * height);
|
||||
#endif
|
||||
ctrGuSetCommandList_First(true,(void*)frame, pitch * height,0,0,0,0);
|
||||
ctrGuCopyImage(true, frame, pitch / (ctr->rgb32? 4: 2), height, ctr->rgb32 ? CTRGU_RGBA8: CTRGU_RGB565, false,
|
||||
ctr->texture_swizzled, ctr->texture_width, ctr->rgb32 ? CTRGU_RGBA8: CTRGU_RGB565, true);
|
||||
ctr->texture_swizzled, ctr->texture_width, ctr->rgb32 ? CTRGU_RGBA8: CTRGU_RGB565, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -661,7 +672,7 @@ static bool ctr_frame(void* data, const void* frame,
|
||||
|
||||
ctr_check_3D_slider(ctr);
|
||||
|
||||
// /* ARGB --> RGBA */
|
||||
/* ARGB --> RGBA */
|
||||
if (ctr->rgb32)
|
||||
{
|
||||
GPU_SetTexEnv(0,
|
||||
@ -758,11 +769,11 @@ static bool ctr_frame(void* data, const void* frame,
|
||||
}
|
||||
|
||||
if (msg)
|
||||
font_driver_render_msg(NULL, msg, NULL);
|
||||
|
||||
// font_driver_render_msg(NULL, "TEST: 123 ABC àüî", NULL);
|
||||
|
||||
font_driver_render_msg(video_info, NULL, msg, NULL);
|
||||
|
||||
#if 0
|
||||
font_driver_render_msg(video_info, NULL, "TEST: 123 ABC àüî", NULL);
|
||||
#endif
|
||||
|
||||
GPU_FinishDrawing();
|
||||
GPUCMD_Finalize();
|
||||
@ -783,7 +794,7 @@ static bool ctr_frame(void* data, const void* frame,
|
||||
gfxTopRightFramebuffers[ctr->current_buffer_top], 240,CTRGU_RGB8, CTRGU_MULTISAMPLE_NONE);
|
||||
|
||||
|
||||
// Swap buffers :
|
||||
/* Swap buffers : */
|
||||
extern GSPGPU_FramebufferInfo topFramebufferInfo;
|
||||
extern u8* gfxSharedMemory;
|
||||
extern u8 gfxThreadID;
|
||||
@ -1094,14 +1105,16 @@ static void ctr_unload_texture(void *data, uintptr_t handle)
|
||||
}
|
||||
|
||||
static void ctr_set_osd_msg(void *data, const char *msg,
|
||||
const struct font_params *params, void *font)
|
||||
const void *params, void *font)
|
||||
{
|
||||
video_frame_info_t video_info;
|
||||
ctr_video_t* ctr = (ctr_video_t*)data;
|
||||
|
||||
if (ctr && ctr->msg_rendering_enabled)
|
||||
font_driver_render_msg(font, msg, params);
|
||||
}
|
||||
video_driver_build_info(&video_info);
|
||||
|
||||
if (ctr && ctr->msg_rendering_enabled)
|
||||
font_driver_render_msg(&video_info, font, msg, params);
|
||||
}
|
||||
|
||||
static const video_poke_interface_t ctr_poke_interface = {
|
||||
ctr_load_texture,
|
||||
|
@ -950,14 +950,17 @@ static void d3d_apply_state_changes(void *data)
|
||||
}
|
||||
|
||||
static void d3d_set_osd_msg(void *data, const char *msg,
|
||||
const struct font_params *params, void *font)
|
||||
const void *params, void *font)
|
||||
{
|
||||
video_frame_info_t video_info;
|
||||
d3d_video_t *d3d = (d3d_video_t*)data;
|
||||
|
||||
video_driver_build_info(&video_info);
|
||||
|
||||
if (d3d->renderchain_driver->set_font_rect && params)
|
||||
d3d->renderchain_driver->set_font_rect(d3d, params);
|
||||
|
||||
font_driver_render_msg(NULL, msg, params);
|
||||
font_driver_render_msg(&video_info, NULL, msg, params);
|
||||
}
|
||||
|
||||
/* Delay constructor due to lack of exceptions. */
|
||||
@ -1442,7 +1445,7 @@ static bool d3d_frame(void *data, const void *frame,
|
||||
if (msg)
|
||||
{
|
||||
struct font_params font_parms = {0};
|
||||
font_driver_render_msg(NULL, msg, &font_parms);
|
||||
font_driver_render_msg(video_info, NULL, msg, &font_parms);
|
||||
}
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
|
@ -253,7 +253,7 @@ static bool gdi_gfx_frame(void *data, const void *frame,
|
||||
}
|
||||
|
||||
if (msg)
|
||||
font_driver_render_msg(NULL, msg, NULL);
|
||||
font_driver_render_msg(video_info, NULL, msg, NULL);
|
||||
|
||||
InvalidateRect(hwnd, NULL, false);
|
||||
|
||||
@ -391,9 +391,11 @@ static void gdi_set_texture_frame(void *data,
|
||||
}
|
||||
|
||||
static void gdi_set_osd_msg(void *data, const char *msg,
|
||||
const struct font_params *params, void *font)
|
||||
const void *params, void *font)
|
||||
{
|
||||
font_driver_render_msg(font, msg, params);
|
||||
video_frame_info_t video_info;
|
||||
video_driver_build_info(&video_info);
|
||||
font_driver_render_msg(&video_info, font, msg, params);
|
||||
}
|
||||
|
||||
static void gdi_get_video_output_size(void *data,
|
||||
|
@ -957,9 +957,11 @@ static void gl_set_texture_enable(void *data, bool state, bool full_screen)
|
||||
}
|
||||
|
||||
static void gl_set_osd_msg(void *data, const char *msg,
|
||||
const struct font_params *params, void *font)
|
||||
const void *params, void *font)
|
||||
{
|
||||
font_driver_render_msg(font, msg, params);
|
||||
video_frame_info_t video_info;
|
||||
video_driver_build_info(&video_info);
|
||||
font_driver_render_msg(&video_info, font, msg, params);
|
||||
}
|
||||
|
||||
static void gl_show_mouse(void *data, bool state)
|
||||
@ -1284,7 +1286,7 @@ static bool gl_frame(void *data, const void *frame,
|
||||
#endif
|
||||
|
||||
if (msg)
|
||||
font_driver_render_msg(NULL, msg, NULL);
|
||||
font_driver_render_msg(video_info, NULL, msg, NULL);
|
||||
|
||||
#ifdef HAVE_OVERLAY
|
||||
gl_render_overlay(gl, video_info);
|
||||
|
@ -729,7 +729,7 @@ static void sdl2_poke_texture_enable(void *data, bool enable, bool full_screen)
|
||||
}
|
||||
|
||||
static void sdl2_poke_set_osd_msg(void *data, const char *msg,
|
||||
const struct font_params *params, void *font)
|
||||
const void *params, void *font)
|
||||
{
|
||||
sdl2_video_t *vid = (sdl2_video_t*)data;
|
||||
sdl2_render_msg(vid, msg);
|
||||
|
@ -16,7 +16,6 @@
|
||||
|
||||
#include <vita2d.h>
|
||||
|
||||
|
||||
#include <retro_inline.h>
|
||||
#include <string/stdstring.h>
|
||||
#include <formats/image.h>
|
||||
@ -250,7 +249,7 @@ static bool vita2d_gfx_frame(void *data, const void *frame,
|
||||
}
|
||||
|
||||
if(!string_is_empty(msg))
|
||||
font_driver_render_msg(NULL, msg, NULL);
|
||||
font_driver_render_msg(video_info, NULL, msg, NULL);
|
||||
|
||||
vita2d_end_drawing();
|
||||
vita2d_swap_buffers();
|
||||
@ -725,10 +724,11 @@ static void vita_unload_texture(void *data, uintptr_t handle)
|
||||
}
|
||||
|
||||
static void vita_set_osd_msg(void *data, const char *msg,
|
||||
const struct font_params *params, void *font)
|
||||
const void *params, void *font)
|
||||
{
|
||||
(void)data;
|
||||
font_driver_render_msg(font, msg, params);
|
||||
video_frame_info_t video_info;
|
||||
video_driver_build_info(&video_info);
|
||||
font_driver_render_msg(&video_info, font, msg, params);
|
||||
}
|
||||
|
||||
static bool vita_get_current_sw_framebuffer(void *data,
|
||||
|
@ -1774,7 +1774,7 @@ static bool vulkan_frame(void *data, const void *frame,
|
||||
#endif
|
||||
|
||||
if (msg)
|
||||
font_driver_render_msg(NULL, msg, NULL);
|
||||
font_driver_render_msg(video_info, NULL, msg, NULL);
|
||||
|
||||
#ifdef HAVE_OVERLAY
|
||||
if (vk->overlay.enable)
|
||||
@ -2140,10 +2140,11 @@ static void vulkan_set_texture_enable(void *data, bool state, bool full_screen)
|
||||
}
|
||||
|
||||
static void vulkan_set_osd_msg(void *data, const char *msg,
|
||||
const struct font_params *params, void *font)
|
||||
const void *params, void *font)
|
||||
{
|
||||
(void)data;
|
||||
font_driver_render_msg(font, msg, params);
|
||||
video_frame_info_t video_info;
|
||||
video_driver_build_info(&video_info);
|
||||
font_driver_render_msg(&video_info, font, msg, params);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -24,7 +24,6 @@
|
||||
#endif
|
||||
|
||||
#include "../font_driver.h"
|
||||
#include "../../configuration.h"
|
||||
#include "../../verbosity.h"
|
||||
#include "../common/caca_common.h"
|
||||
|
||||
@ -74,7 +73,8 @@ static const struct font_glyph *caca_font_get_glyph(
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void caca_render_msg(void *data, const char *msg,
|
||||
static void caca_render_msg(video_frame_info_t *video_info,
|
||||
void *data, const char *msg,
|
||||
const void *userdata)
|
||||
{
|
||||
float x, y;
|
||||
@ -93,10 +93,8 @@ static void caca_render_msg(void *data, const char *msg,
|
||||
}
|
||||
else
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
x = settings->video.msg_pos_x;
|
||||
y = settings->video.msg_pos_y;
|
||||
x = video_info->font_msg_pos_x;
|
||||
y = video_info->font_msg_pos_y;
|
||||
}
|
||||
|
||||
if (!font->caca || !font->caca->caca_cv || !font->caca->caca_display ||
|
||||
|
@ -351,23 +351,24 @@ static void ctr_font_render_message(
|
||||
}
|
||||
}
|
||||
|
||||
static void ctr_font_render_msg(void* data, const char* msg,
|
||||
const void* userdata)
|
||||
static void ctr_font_render_msg(
|
||||
video_frame_info_t *video_info,
|
||||
void* data, const char* msg,
|
||||
const void* userdata)
|
||||
{
|
||||
float x, y, scale, drop_mod, drop_alpha;
|
||||
unsigned width, height;
|
||||
int drop_x, drop_y;
|
||||
unsigned max_glyphs;
|
||||
enum text_alignment text_align;
|
||||
unsigned color, color_dark, r, g, b, alpha, r_dark, g_dark, b_dark, alpha_dark;
|
||||
ctr_font_t * font = (ctr_font_t*)data;
|
||||
const struct font_params* params = (const struct font_params*)userdata;
|
||||
unsigned width = video_info->width;
|
||||
unsigned height = video_info->height;
|
||||
|
||||
if (!font || !msg || !*msg)
|
||||
return;
|
||||
|
||||
video_driver_get_size(&width, &height);
|
||||
|
||||
if (params)
|
||||
{
|
||||
x = params->x;
|
||||
@ -386,16 +387,14 @@ static void ctr_font_render_msg(void* data, const char* msg,
|
||||
}
|
||||
else
|
||||
{
|
||||
settings_t* settings = config_get_ptr();
|
||||
|
||||
x = settings->video.msg_pos_x;
|
||||
y = settings->video.msg_pos_y;
|
||||
x = video_info->font_msg_pos_x;
|
||||
y = video_info->font_msg_pos_y;
|
||||
scale = 1.0f;
|
||||
text_align = TEXT_ALIGN_LEFT;
|
||||
|
||||
r = (settings->video.msg_color_r * 255);
|
||||
g = (settings->video.msg_color_g * 255);
|
||||
b = (settings->video.msg_color_b * 255);
|
||||
r = (video_info->font_msg_color_r * 255);
|
||||
g = (video_info->font_msg_color_g * 255);
|
||||
b = (video_info->font_msg_color_b * 255);
|
||||
alpha = 255;
|
||||
color = COLOR_ABGR(r, g, b, alpha);
|
||||
|
||||
|
@ -79,23 +79,23 @@ static const struct font_glyph *gdi_font_get_glyph(
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void gdi_render_msg(void *data, const char *msg,
|
||||
static void gdi_render_msg(
|
||||
video_frame_info_t *video_info,
|
||||
void *data, const char *msg,
|
||||
const void *userdata)
|
||||
{
|
||||
gdi_raster_t *font = (gdi_raster_t*)data;
|
||||
float x, y;
|
||||
unsigned width = 0, height = 0;
|
||||
unsigned newX, newY, len;
|
||||
settings_t *settings = config_get_ptr();
|
||||
const struct font_params *params = (const struct font_params*)userdata;
|
||||
HDC hdc;
|
||||
HWND hwnd = win32_get_window();
|
||||
float x, y;
|
||||
gdi_raster_t *font = (gdi_raster_t*)data;
|
||||
unsigned newX, newY, len;
|
||||
const struct font_params *params = (const struct font_params*)userdata;
|
||||
HWND hwnd = win32_get_window();
|
||||
unsigned width = video_info->width;
|
||||
unsigned height = video_info->height;
|
||||
|
||||
if (!font || string_is_empty(msg))
|
||||
return;
|
||||
|
||||
video_driver_get_size(&width, &height);
|
||||
|
||||
if (params)
|
||||
{
|
||||
x = params->x;
|
||||
@ -103,18 +103,18 @@ static void gdi_render_msg(void *data, const char *msg,
|
||||
}
|
||||
else
|
||||
{
|
||||
x = settings->video.msg_pos_x;
|
||||
y = settings->video.msg_pos_y;
|
||||
x = video_info->font_msg_pos_x;
|
||||
y = video_info->font_msg_pos_y;
|
||||
}
|
||||
|
||||
if (!font->gdi)
|
||||
return;
|
||||
|
||||
len = utf8len(msg);
|
||||
len = utf8len(msg);
|
||||
newX = x * width;
|
||||
newY = height - (y * height);
|
||||
hdc = GetDC(hwnd);
|
||||
|
||||
hdc = GetDC(hwnd);
|
||||
SetBkMode(hdc, TRANSPARENT);
|
||||
SetTextColor(hdc, RGB(255,255,255));
|
||||
TextOut(hdc, newX, newY, msg, len);
|
||||
|
@ -25,8 +25,6 @@
|
||||
#include "../video_shader_driver.h"
|
||||
#include "../video_context_driver.h"
|
||||
|
||||
#include "../../configuration.h"
|
||||
|
||||
/* TODO: Move viewport side effects to the caller: it's a source of bugs. */
|
||||
|
||||
#define gl_raster_font_emit(c, vx, vy) do { \
|
||||
@ -424,7 +422,9 @@ static void gl_raster_font_restore_viewport(gl_t *gl, bool full_screen)
|
||||
video_driver_set_viewport(width, height, full_screen, true);
|
||||
}
|
||||
|
||||
static void gl_raster_font_render_msg(void *data, const char *msg,
|
||||
static void gl_raster_font_render_msg(
|
||||
video_frame_info_t *video_info,
|
||||
void *data, const char *msg,
|
||||
const void *userdata)
|
||||
{
|
||||
GLfloat x, y, scale, drop_mod, drop_alpha;
|
||||
@ -467,16 +467,15 @@ static void gl_raster_font_render_msg(void *data, const char *msg,
|
||||
}
|
||||
else
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
x = settings->video.msg_pos_x;
|
||||
y = settings->video.msg_pos_y;
|
||||
x = video_info->font_msg_pos_x;
|
||||
y = video_info->font_msg_pos_y;
|
||||
scale = 1.0f;
|
||||
full_screen = true;
|
||||
text_align = TEXT_ALIGN_LEFT;
|
||||
|
||||
color[0] = settings->video.msg_color_r;
|
||||
color[1] = settings->video.msg_color_g;
|
||||
color[2] = settings->video.msg_color_b;
|
||||
color[0] = video_info->font_msg_color_r;
|
||||
color[1] = video_info->font_msg_color_g;
|
||||
color[2] = video_info->font_msg_color_b;
|
||||
color[3] = 1.0f;
|
||||
|
||||
drop_x = -2;
|
||||
|
@ -63,7 +63,9 @@ static void libdbg_font_free_font(void *data)
|
||||
DbgFontExit();
|
||||
}
|
||||
|
||||
static void libdbg_font_render_msg(void *data, const char *msg,
|
||||
static void libdbg_font_render_msg(
|
||||
video_frame_info_t *video_info,
|
||||
void *data, const char *msg,
|
||||
const void *userdata)
|
||||
{
|
||||
float x, y, scale;
|
||||
@ -81,8 +83,7 @@ static void libdbg_font_render_msg(void *data, const char *msg,
|
||||
}
|
||||
else
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
x = settings->video.msg_pos_x;
|
||||
x = video_info->font_msg_pos_x;
|
||||
y = 0.90f;
|
||||
scale = 1.04f;
|
||||
color = SILVER;
|
||||
|
@ -22,7 +22,6 @@
|
||||
|
||||
#include "../font_driver.h"
|
||||
|
||||
#include "../../configuration.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
typedef struct
|
||||
@ -261,23 +260,24 @@ static void vita2d_font_render_message(
|
||||
}
|
||||
}
|
||||
|
||||
static void vita2d_font_render_msg(void *data, const char *msg,
|
||||
static void vita2d_font_render_msg(
|
||||
video_frame_info_t *video_info,
|
||||
void *data, const char *msg,
|
||||
const void *userdata)
|
||||
{
|
||||
float x, y, scale, drop_mod, drop_alpha;
|
||||
unsigned width, height;
|
||||
int drop_x, drop_y;
|
||||
unsigned max_glyphs;
|
||||
enum text_alignment text_align;
|
||||
unsigned color, color_dark, r, g, b, alpha, r_dark, g_dark, b_dark, alpha_dark;
|
||||
vita_font_t *font = (vita_font_t *)data;
|
||||
const struct font_params *params = (const struct font_params*)userdata;
|
||||
unsigned width = video_info->width;
|
||||
unsigned height = video_info->height;
|
||||
|
||||
if (!font || !msg || !*msg)
|
||||
return;
|
||||
|
||||
video_driver_get_size(&width, &height);
|
||||
|
||||
if (params)
|
||||
{
|
||||
x = params->x;
|
||||
@ -296,16 +296,14 @@ static void vita2d_font_render_msg(void *data, const char *msg,
|
||||
}
|
||||
else
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
x = settings->video.msg_pos_x;
|
||||
y = settings->video.msg_pos_y;
|
||||
x = video_info->font_msg_pos_x;
|
||||
y = video_info->font_msg_pos_y;
|
||||
scale = 1.0f;
|
||||
text_align = TEXT_ALIGN_LEFT;
|
||||
|
||||
r = (settings->video.msg_color_r * 255);
|
||||
g = (settings->video.msg_color_g * 255);
|
||||
b = (settings->video.msg_color_b * 255);
|
||||
r = (video_info->font_msg_color_r * 255);
|
||||
g = (video_info->font_msg_color_g * 255);
|
||||
b = (video_info->font_msg_color_b * 255);
|
||||
alpha = 255;
|
||||
color = RGBA8(r,g,b,alpha);
|
||||
|
||||
|
@ -21,8 +21,6 @@
|
||||
|
||||
#include "../font_driver.h"
|
||||
|
||||
#include "../../configuration.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
vk_t *vk;
|
||||
@ -258,7 +256,9 @@ static void vulkan_raster_font_flush(vulkan_raster_t *font)
|
||||
vulkan_draw_triangles(font->vk, &call);
|
||||
}
|
||||
|
||||
static void vulkan_raster_font_render_msg(void *data, const char *msg,
|
||||
static void vulkan_raster_font_render_msg(
|
||||
video_frame_info_t *video_info,
|
||||
void *data, const char *msg,
|
||||
const void *userdata)
|
||||
{
|
||||
float color[4], color_dark[4];
|
||||
@ -299,17 +299,15 @@ static void vulkan_raster_font_render_msg(void *data, const char *msg,
|
||||
}
|
||||
else
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
x = settings->video.msg_pos_x;
|
||||
y = settings->video.msg_pos_y;
|
||||
x = video_info->font_msg_pos_x;
|
||||
y = video_info->font_msg_pos_y;
|
||||
scale = 1.0f;
|
||||
full_screen = true;
|
||||
text_align = TEXT_ALIGN_LEFT;
|
||||
|
||||
color[0] = settings->video.msg_color_r;
|
||||
color[1] = settings->video.msg_color_g;
|
||||
color[2] = settings->video.msg_color_b;
|
||||
color[0] = video_info->font_msg_color_r;
|
||||
color[1] = video_info->font_msg_color_g;
|
||||
color[2] = video_info->font_msg_color_b;
|
||||
color[3] = 1.0f;
|
||||
|
||||
drop_x = -2;
|
||||
|
@ -63,7 +63,9 @@ static void xfonts_free_font(void *data)
|
||||
font = NULL;
|
||||
}
|
||||
|
||||
static void xfonts_render_msg(void *data, const char *msg,
|
||||
static void xfonts_render_msg(
|
||||
video_frame_info_t *video_info,
|
||||
void *data, const char *msg,
|
||||
const void *userdata)
|
||||
{
|
||||
wchar_t str[PATH_MAX_LENGTH];
|
||||
@ -78,10 +80,8 @@ static void xfonts_render_msg(void *data, const char *msg,
|
||||
}
|
||||
else
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
x = settings->video.msg_pos_x;
|
||||
y = settings->video.msg_pos_y;
|
||||
x = video_info->font_msg_pos_x;
|
||||
y = video_info->font_msg_pos_y;
|
||||
}
|
||||
|
||||
xfonts->d3d->dev->GetBackBuffer(-1, D3DBACKBUFFER_TYPE_MONO, &xfonts->surf);
|
||||
|
@ -803,7 +803,9 @@ static void xdk360_draw_text(xdk360_video_font_t *font,
|
||||
d3dr->EndVertices();
|
||||
}
|
||||
|
||||
static void xdk360_render_msg(void *data, const char *str_msg,
|
||||
static void xdk360_render_msg(
|
||||
video_frame_info_t *video_info,
|
||||
void *data, const char *str_msg,
|
||||
const void *userdata)
|
||||
{
|
||||
float x, y;
|
||||
|
@ -346,12 +346,14 @@ static bool font_init_first(
|
||||
return false;
|
||||
}
|
||||
|
||||
void font_driver_render_msg(void *font_data,
|
||||
const char *msg, const struct font_params *params)
|
||||
void font_driver_render_msg(
|
||||
video_frame_info_t *video_info,
|
||||
void *font_data,
|
||||
const char *msg, const void *params)
|
||||
{
|
||||
font_data_t *font = (font_data_t*)(font_data ? font_data : video_font_driver);
|
||||
if (font && font->renderer && font->renderer->render_msg)
|
||||
font->renderer->render_msg(font->renderer_data, msg, params);
|
||||
font->renderer->render_msg(video_info, font->renderer_data, msg, params);
|
||||
}
|
||||
|
||||
void font_driver_bind_block(void *font_data, void *block)
|
||||
|
@ -22,6 +22,8 @@
|
||||
#include <boolean.h>
|
||||
#include <retro_common_api.h>
|
||||
|
||||
#include "video_driver.h"
|
||||
|
||||
RETRO_BEGIN_DECLS
|
||||
|
||||
enum font_driver_render_api
|
||||
@ -100,7 +102,9 @@ typedef struct font_renderer
|
||||
{
|
||||
void *(*init)(void *data, const char *font_path, float font_size);
|
||||
void (*free)(void *data);
|
||||
void (*render_msg)(void *data, const char *msg,
|
||||
void (*render_msg)(
|
||||
video_frame_info_t *video_info,
|
||||
void *data, const char *msg,
|
||||
const void *params);
|
||||
const char *ident;
|
||||
|
||||
@ -140,7 +144,8 @@ typedef struct
|
||||
int font_renderer_create_default(const void **driver,
|
||||
void **handle, const char *font_path, unsigned font_size);
|
||||
|
||||
void font_driver_render_msg(void *font_data, const char *msg, const struct font_params *params);
|
||||
void font_driver_render_msg(video_frame_info_t *video_info,
|
||||
void *font_data, const char *msg, const void *params);
|
||||
|
||||
void font_driver_bind_block(void *font_data, void *block);
|
||||
|
||||
|
@ -900,11 +900,10 @@ bool video_driver_get_video_output_size(unsigned *width, unsigned *height)
|
||||
return true;
|
||||
}
|
||||
|
||||
void video_driver_set_osd_msg(const char *msg,
|
||||
const struct font_params *params, void *font)
|
||||
void video_driver_set_osd_msg(const char *msg, const void *data, void *font)
|
||||
{
|
||||
if (video_driver_poke && video_driver_poke->set_osd_msg)
|
||||
video_driver_poke->set_osd_msg(video_driver_data, msg, params, font);
|
||||
video_driver_poke->set_osd_msg(video_driver_data, msg, data, font);
|
||||
}
|
||||
|
||||
void video_driver_set_texture_enable(bool enable, bool fullscreen)
|
||||
@ -2268,6 +2267,11 @@ void video_driver_build_info(video_frame_info_t *video_info)
|
||||
video_info->monitor_index = settings->video.monitor_index;
|
||||
video_info->shared_context = settings->video.shared_context;
|
||||
video_info->font_enable = settings->video.font_enable;
|
||||
video_info->font_msg_pos_x = settings->video.msg_pos_x;
|
||||
video_info->font_msg_pos_y = settings->video.msg_pos_y;
|
||||
video_info->font_msg_color_r = settings->video.msg_color_r;
|
||||
video_info->font_msg_color_g = settings->video.msg_color_g;
|
||||
video_info->font_msg_color_b = settings->video.msg_color_b;
|
||||
|
||||
video_info->frame_count = 0;
|
||||
video_info->fps_text[0] = '\0';
|
||||
|
@ -32,7 +32,6 @@
|
||||
#include "../input/input_overlay.h"
|
||||
#endif
|
||||
|
||||
#include "font_driver.h"
|
||||
#include "video_defines.h"
|
||||
#include "video_filter.h"
|
||||
#include "video_shader_parse.h"
|
||||
@ -107,6 +106,12 @@ typedef struct video_frame_info
|
||||
|
||||
unsigned width;
|
||||
unsigned height;
|
||||
|
||||
float font_msg_pos_x;
|
||||
float font_msg_pos_y;
|
||||
float font_msg_color_r;
|
||||
float font_msg_color_g;
|
||||
float font_msg_color_b;
|
||||
} video_frame_info_t;
|
||||
|
||||
/* Optionally implemented interface to poke more
|
||||
@ -142,7 +147,7 @@ typedef struct video_poke_interface
|
||||
/* Enable or disable rendering. */
|
||||
void (*set_texture_enable)(void *data, bool enable, bool full_screen);
|
||||
void (*set_osd_msg)(void *data, const char *msg,
|
||||
const struct font_params *params, void *font);
|
||||
const void *params, void *font);
|
||||
|
||||
void (*show_mouse)(void *data, bool state);
|
||||
void (*grab_mouse_toggle)(void *data);
|
||||
@ -376,7 +381,7 @@ bool video_driver_get_video_output_size(
|
||||
unsigned *width, unsigned *height);
|
||||
|
||||
void video_driver_set_osd_msg(const char *msg,
|
||||
const struct font_params *params, void *font);
|
||||
const void *params, void *font);
|
||||
|
||||
void video_driver_set_texture_enable(bool enable, bool full_screen);
|
||||
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <retro_common_api.h>
|
||||
|
||||
#include "video_driver.h"
|
||||
#include "font_driver.h"
|
||||
|
||||
RETRO_BEGIN_DECLS
|
||||
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include <gfx/math/matrix_4x4.h>
|
||||
|
||||
#include "../file_path_special.h"
|
||||
#include "../gfx/font_driver.h"
|
||||
#include "../gfx/video_context_driver.h"
|
||||
#include "../gfx/video_coord_array.h"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user