mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-27 10:10:57 +00:00
Rename d3d_w32_font.c to d3d9x_w32_font.c
This commit is contained in:
parent
020e5fd7af
commit
77466d6f85
@ -1679,7 +1679,7 @@ ifeq ($(HAVE_D3D9), 1)
|
||||
endif
|
||||
endif
|
||||
HAVE_DX_COMMON = 1
|
||||
OBJ += gfx/drivers_font/d3d_w32_font.o
|
||||
OBJ += gfx/drivers_font/d3d9x_w32_font.o
|
||||
ifeq ($(HAVE_CG), 1)
|
||||
LIBS += -lcgD3D9
|
||||
OBJ += gfx/drivers/d3d9cg.o
|
||||
|
@ -439,36 +439,6 @@ bool d3d9x_compile_shader(
|
||||
return false;
|
||||
}
|
||||
|
||||
void d3d9x_font_draw_text(void *data, void *sprite_data, void *string_data,
|
||||
unsigned count, void *rect_data, unsigned format, unsigned color)
|
||||
{
|
||||
#ifdef HAVE_D3DX
|
||||
ID3DXFont *font = (ID3DXFont*)data;
|
||||
if (font)
|
||||
font->lpVtbl->DrawText(font, (LPD3DXSPRITE)sprite_data,
|
||||
(LPCTSTR)string_data, count, (LPRECT)rect_data,
|
||||
(DWORD)format, (D3DCOLOR)color);
|
||||
#endif
|
||||
}
|
||||
|
||||
void d3d9x_font_release(void *data)
|
||||
{
|
||||
#ifdef HAVE_D3DX
|
||||
ID3DXFont *font = (ID3DXFont*)data;
|
||||
if (font)
|
||||
font->lpVtbl->Release(font);
|
||||
#endif
|
||||
}
|
||||
|
||||
void d3d9x_font_get_text_metrics(void *data, void *metrics)
|
||||
{
|
||||
#ifdef HAVE_D3DX
|
||||
ID3DXFont *font = (ID3DXFont*)data;
|
||||
if (font)
|
||||
font->lpVtbl->GetTextMetrics(font, (TEXTMETRICA*)metrics);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool d3d9x_compile_shader_from_file(
|
||||
const char *src,
|
||||
const void *pdefines,
|
||||
|
@ -175,13 +175,6 @@ void d3d9_deinitialize_symbols(void);
|
||||
bool d3d9x_create_font_indirect(void *dev,
|
||||
void *desc, void **font_data);
|
||||
|
||||
void d3d9x_font_draw_text(void *data, void *sprite_data, void *string_data,
|
||||
unsigned count, void *rect_data, unsigned format, unsigned color);
|
||||
|
||||
void d3d9x_font_get_text_metrics(void *data, void *metrics);
|
||||
|
||||
void d3d9x_font_release(void *data);
|
||||
|
||||
bool d3d9x_compile_shader(
|
||||
const char *src,
|
||||
unsigned src_data_len,
|
||||
|
@ -24,13 +24,18 @@
|
||||
#include "../../config.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_D3DX
|
||||
|
||||
#include <d3dx9core.h>
|
||||
#include <d3dx9tex.h>
|
||||
|
||||
#include "../common/d3d_common.h"
|
||||
#include "../common/d3d9_common.h"
|
||||
#include "../font_driver.h"
|
||||
|
||||
#include "../../configuration.h"
|
||||
|
||||
typedef struct d3dx_font_desc
|
||||
typedef struct d3d9x_font_desc
|
||||
{
|
||||
INT Height;
|
||||
UINT Width;
|
||||
@ -42,7 +47,7 @@ typedef struct d3dx_font_desc
|
||||
BYTE Quality;
|
||||
BYTE PitchAndFamily;
|
||||
CHAR FaceName[32];
|
||||
} d3dx_font_desc_t;
|
||||
} d3d9x_font_desc_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@ -52,12 +57,29 @@ typedef struct
|
||||
uint32_t ascent;
|
||||
} d3dfonts_t;
|
||||
|
||||
static void *d3d_win32_font_init(void *video_data,
|
||||
static void d3d9x_font_release(ID3DXFont *font)
|
||||
{
|
||||
font->lpVtbl->Release(font);
|
||||
}
|
||||
|
||||
static void d3d9x_font_get_text_metrics(ID3DXFont *font, TEXTMETRICA *metrics)
|
||||
{
|
||||
font->lpVtbl->GetTextMetrics(font, metrics);
|
||||
}
|
||||
|
||||
static void d3d9x_font_draw_text(ID3DXFont *font, LPD3DXSPRITE sprite_data, LPCTSTR string_data,
|
||||
unsigned count, LPRECT rect_data, DWORD format, D3DCOLOR color)
|
||||
{
|
||||
font->lpVtbl->DrawText(font, sprite_data,
|
||||
string_data, count, rect_data, format, color);
|
||||
}
|
||||
|
||||
static void *d3d9x_win32_font_init(void *video_data,
|
||||
const char *font_path, float font_size,
|
||||
bool is_threaded)
|
||||
{
|
||||
TEXTMETRICA metrics;
|
||||
d3dx_font_desc_t desc;
|
||||
d3d9x_font_desc_t desc;
|
||||
d3dfonts_t *d3dfonts = (d3dfonts_t*)calloc(1, sizeof(*d3dfonts));
|
||||
if (!d3dfonts)
|
||||
return NULL;
|
||||
@ -71,13 +93,14 @@ static void *d3d_win32_font_init(void *video_data,
|
||||
desc.OutputPrecision = OUT_TT_PRECIS;
|
||||
desc.Quality = CLIP_DEFAULT_PRECIS;
|
||||
desc.PitchAndFamily = DEFAULT_PITCH;
|
||||
/* TODO/FIXME - don't hardcode this font */
|
||||
#ifdef UNICODE
|
||||
strlcpy(desc.FaceName, T(L"Verdana"), sizeof(desc.FaceName));
|
||||
#else
|
||||
strlcpy(desc.FaceName, (const char*)_T("Verdana"), sizeof(desc.FaceName));
|
||||
#endif
|
||||
|
||||
d3dfonts->font_size = font_size * 1.2; /* to match the other font drivers */
|
||||
d3dfonts->font_size = font_size * 1.2; /* To match the other font drivers */
|
||||
d3dfonts->d3d = (d3d9_video_t*)video_data;
|
||||
|
||||
desc.Height = d3dfonts->font_size;
|
||||
@ -97,7 +120,7 @@ error:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void d3d_win32_font_free(void *data, bool is_threaded)
|
||||
static void d3d9x_win32_font_free(void *data, bool is_threaded)
|
||||
{
|
||||
d3dfonts_t *d3dfonts = (d3dfonts_t*)data;
|
||||
|
||||
@ -105,12 +128,12 @@ static void d3d_win32_font_free(void *data, bool is_threaded)
|
||||
return;
|
||||
|
||||
if (d3dfonts->font)
|
||||
d3d9x_font_release(d3dfonts->font);
|
||||
d3d9x_font_release((ID3DXFont*)d3dfonts->font);
|
||||
|
||||
free(d3dfonts);
|
||||
}
|
||||
|
||||
static int d3d_win32_font_get_message_width(void* data, const char* msg,
|
||||
static int d3d9x_win32_font_get_message_width(void* data, const char* msg,
|
||||
size_t msg_len, float scale)
|
||||
{
|
||||
RECT box = {0,0,0,0};
|
||||
@ -125,12 +148,12 @@ static int d3d_win32_font_get_message_width(void* data, const char* msg,
|
||||
return box.right - box.left;
|
||||
}
|
||||
|
||||
static void d3d_win32_font_render_msg(
|
||||
static void d3d9x_win32_font_render_msg(
|
||||
void *userdata,
|
||||
void *data, const char *msg,
|
||||
const struct font_params *params)
|
||||
{
|
||||
unsigned format;
|
||||
DWORD format;
|
||||
unsigned a, r, g, b;
|
||||
unsigned width, height;
|
||||
RECT rect, rect_shifted;
|
||||
@ -228,14 +251,16 @@ static void d3d_win32_font_render_msg(
|
||||
p_rect, format, D3DCOLOR_ARGB(a, r, g, b));
|
||||
}
|
||||
|
||||
font_renderer_t d3d_win32_font = {
|
||||
d3d_win32_font_init,
|
||||
d3d_win32_font_free,
|
||||
d3d_win32_font_render_msg,
|
||||
"d3d_win32_font",
|
||||
font_renderer_t d3d9x_win32_font = {
|
||||
d3d9x_win32_font_init,
|
||||
d3d9x_win32_font_free,
|
||||
d3d9x_win32_font_render_msg,
|
||||
"d3d9x",
|
||||
NULL, /* get_glyph */
|
||||
NULL, /* bind_block */
|
||||
NULL, /* flush */
|
||||
d3d_win32_font_get_message_width,
|
||||
d3d9x_win32_font_get_message_width,
|
||||
NULL /* get_line_metrics */
|
||||
};
|
||||
|
||||
#endif
|
@ -183,7 +183,7 @@ static bool font_init_first(
|
||||
{
|
||||
static const font_renderer_t *d3d9_font_backends[] = {
|
||||
#if defined(_WIN32) && defined(HAVE_D3DX)
|
||||
&d3d_win32_font,
|
||||
&d3d9x_win32_font,
|
||||
#endif
|
||||
NULL
|
||||
};
|
||||
|
@ -114,7 +114,7 @@ extern font_renderer_t gl2_raster_font;
|
||||
extern font_renderer_t gl3_raster_font;
|
||||
extern font_renderer_t gl1_raster_font;
|
||||
extern font_renderer_t d3d_xdk1_font;
|
||||
extern font_renderer_t d3d_win32_font;
|
||||
extern font_renderer_t d3d9x_win32_font;
|
||||
extern font_renderer_t ps2_font;
|
||||
extern font_renderer_t vita2d_vita_font;
|
||||
extern font_renderer_t ctr_font;
|
||||
|
@ -583,7 +583,7 @@ FONTS
|
||||
#include "../gfx/font_driver.c"
|
||||
|
||||
#if defined(HAVE_D3D9) && defined(HAVE_D3DX)
|
||||
#include "../gfx/drivers_font/d3d_w32_font.c"
|
||||
#include "../gfx/drivers_font/d3d9x_w32_font.c"
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_STB_FONT)
|
||||
|
Loading…
Reference in New Issue
Block a user