mirror of
https://github.com/libretro/RetroArch
synced 2025-02-11 15:40:28 +00:00
(Fonts) Cleanups
This commit is contained in:
parent
6ff82319fb
commit
527d1557ce
@ -27,7 +27,6 @@
|
||||
|
||||
#include "../font_driver.h"
|
||||
#include "../../configuration.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@ -50,10 +49,7 @@ static void *caca_font_init(void *data,
|
||||
if (!font_renderer_create_default(
|
||||
&font->font_driver,
|
||||
&font->font_data, font_path, font_size))
|
||||
{
|
||||
RARCH_WARN("Couldn't initialize font renderer.\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return font;
|
||||
}
|
||||
|
@ -29,7 +29,6 @@
|
||||
#include "../../ctr/gpu_old.h"
|
||||
|
||||
#include "../../configuration.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@ -58,7 +57,6 @@ static void* ctr_font_init(void* data, const char* font_path,
|
||||
&font->font_driver,
|
||||
&font->font_data, font_path, font_size))
|
||||
{
|
||||
RARCH_WARN("Couldn't initialize font renderer.\n");
|
||||
free(font);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -25,7 +25,6 @@
|
||||
#include "../common/d3d10_common.h"
|
||||
|
||||
#include "../../configuration.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@ -47,7 +46,6 @@ static void *d3d10_font_init(void* data, const char* font_path,
|
||||
if (!font_renderer_create_default(
|
||||
&font->font_driver, &font->font_data, font_path, font_size))
|
||||
{
|
||||
RARCH_WARN("Couldn't initialize font renderer.\n");
|
||||
free(font);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include "../common/d3d11_common.h"
|
||||
|
||||
#include "../../configuration.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@ -46,7 +45,6 @@ static void * d3d11_font_init(void* data, const char* font_path,
|
||||
if (!font_renderer_create_default(
|
||||
&font->font_driver, &font->font_data, font_path, font_size))
|
||||
{
|
||||
RARCH_WARN("Couldn't initialize font renderer.\n");
|
||||
free(font);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include "../common/d3d12_common.h"
|
||||
|
||||
#include "../../configuration.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@ -47,7 +46,6 @@ static void * d3d12_font_init(void* data, const char* font_path,
|
||||
&font->font_driver,
|
||||
&font->font_data, font_path, font_size))
|
||||
{
|
||||
RARCH_WARN("Couldn't initialize font renderer.\n");
|
||||
free(font);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -33,7 +33,6 @@
|
||||
|
||||
#include "../font_driver.h"
|
||||
#include "../../configuration.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@ -56,10 +55,7 @@ static void *gdi_font_init(void *data,
|
||||
if (!font_renderer_create_default(
|
||||
&font->font_driver,
|
||||
&font->font_data, font_path, font_size))
|
||||
{
|
||||
RARCH_WARN("Couldn't initialize font renderer.\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return font;
|
||||
}
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include "../common/gl1_common.h"
|
||||
#include "../font_driver.h"
|
||||
#include "../../configuration.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
/* TODO: Move viewport side effects to the caller: it's a source of bugs. */
|
||||
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include "../common/gl2_common.h"
|
||||
#include "../font_driver.h"
|
||||
#include "../../configuration.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
/* TODO: Move viewport side effects to the caller: it's a source of bugs. */
|
||||
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include "../common/gl3_common.h"
|
||||
#include "../font_driver.h"
|
||||
#include "../../configuration.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
/* TODO: Move viewport side effects to the caller: it's a source of bugs. */
|
||||
|
||||
@ -111,7 +110,6 @@ static void *gl3_raster_font_init(void *data,
|
||||
&font->font_driver,
|
||||
&font->font_data, font_path, font_size))
|
||||
{
|
||||
RARCH_WARN("Couldn't initialize font renderer.\n");
|
||||
free(font);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include "../font_driver.h"
|
||||
|
||||
#include "../../configuration.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
@interface MetalRaster : NSObject
|
||||
{
|
||||
@ -77,10 +76,7 @@
|
||||
if (!font_renderer_create_default(
|
||||
&_font_driver,
|
||||
&_font_data, font_path, font_size))
|
||||
{
|
||||
RARCH_WARN("Couldn't initialize font renderer.\n");
|
||||
return nil;
|
||||
}
|
||||
|
||||
_uniforms.projectionMatrix = matrix_proj_ortho(0, 1, 0, 1);
|
||||
_atlas = _font_driver->get_atlas(_font_data);
|
||||
@ -128,17 +124,17 @@
|
||||
_vert = [_context.device newBufferWithLength:sizeof(SpriteVertex) *
|
||||
_capacity options:PLATFORM_METAL_RESOURCE_STORAGE_MODE];
|
||||
if (![self _initializeState])
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (bool)_initializeState
|
||||
{
|
||||
{
|
||||
NSError *err;
|
||||
MTLVertexDescriptor *vd = [MTLVertexDescriptor new];
|
||||
|
||||
vd.attributes[0].offset = 0;
|
||||
vd.attributes[0].format = MTLVertexFormatFloat2;
|
||||
vd.attributes[1].offset = offsetof(SpriteVertex, texCoord);
|
||||
@ -164,14 +160,10 @@
|
||||
psd.vertexFunction = [_context.library newFunctionWithName:@"sprite_vertex"];
|
||||
psd.fragmentFunction = [_context.library newFunctionWithName:@"sprite_fragment_a8"];
|
||||
|
||||
NSError *err;
|
||||
_state = [_context.device newRenderPipelineStateWithDescriptor:psd error:&err];
|
||||
if (err != nil)
|
||||
{
|
||||
RARCH_ERR("[MetalRaster]: error creating pipeline state: %s\n", err.localizedDescription.UTF8String);
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
MTLSamplerDescriptor *sd = [MTLSamplerDescriptor new];
|
||||
@ -206,10 +198,11 @@
|
||||
|
||||
- (int)getWidthForMessage:(const char *)msg length:(NSUInteger)length scale:(float)scale
|
||||
{
|
||||
NSUInteger i;
|
||||
int delta_x = 0;
|
||||
const struct font_glyph* glyph_q = _font_driver->get_glyph(_font_data, '?');
|
||||
|
||||
for (NSUInteger i = 0; i < length; i++)
|
||||
for (i = 0; i < length; i++)
|
||||
{
|
||||
const struct font_glyph *glyph;
|
||||
/* Do something smarter here ... */
|
||||
@ -231,10 +224,7 @@
|
||||
|
||||
const struct font_glyph *glyph = _font_driver->get_glyph((void *)_font_driver, code);
|
||||
if (glyph)
|
||||
{
|
||||
[self updateGlyph:glyph];
|
||||
}
|
||||
|
||||
return glyph;
|
||||
}
|
||||
|
||||
@ -377,8 +367,8 @@ static INLINE void write_quad6(SpriteVertex *pv,
|
||||
struct font_line_metrics *line_metrics = NULL;
|
||||
|
||||
/* If font line metrics are not supported just draw as usual */
|
||||
if (!_font_driver->get_line_metrics ||
|
||||
!_font_driver->get_line_metrics(_font_data, &line_metrics))
|
||||
if ( !_font_driver->get_line_metrics
|
||||
|| !_font_driver->get_line_metrics(_font_data, &line_metrics))
|
||||
{
|
||||
[self _renderLine:msg length:strlen(msg) scale:scale color:color posX:posX posY:posY aligned:aligned];
|
||||
return;
|
||||
|
@ -27,7 +27,6 @@
|
||||
#include "../font_driver.h"
|
||||
|
||||
#include "../../configuration.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@ -53,7 +52,6 @@ static void* ps2_font_init(void* data, const char* font_path,
|
||||
&font->font_driver,
|
||||
&font->font_data, font_path, font_size))
|
||||
{
|
||||
RARCH_WARN("Couldn't initialize font renderer.\n");
|
||||
free(font);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -25,7 +25,6 @@
|
||||
#include "../font_driver.h"
|
||||
|
||||
#include "../../configuration.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
#define RSX_FONT_EMIT(c, vx, vy) \
|
||||
font_vertex[ 2 * (6 * i + c) + 0] = (x + (delta_x + off_x + vx * width) * scale) * inv_win_width; \
|
||||
@ -147,7 +146,6 @@ static void *rsx_font_init(void *data,
|
||||
&font->font_driver,
|
||||
&font->font_data, font_path, font_size))
|
||||
{
|
||||
RARCH_WARN("Couldn't initialize font renderer.\n");
|
||||
free(font);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -25,7 +25,6 @@
|
||||
|
||||
#include "../font_driver.h"
|
||||
#include "../../configuration.h"
|
||||
#include "../../verbosity.h"
|
||||
#include "../common/sixel_common.h"
|
||||
|
||||
typedef struct
|
||||
@ -49,10 +48,7 @@ static void *sixel_font_init(void *data,
|
||||
if (!font_renderer_create_default(
|
||||
&font->font_driver,
|
||||
&font->font_data, font_path, font_size))
|
||||
{
|
||||
RARCH_WARN("Couldn't initialize font renderer.\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return font;
|
||||
}
|
||||
|
@ -26,7 +26,6 @@
|
||||
#include "../font_driver.h"
|
||||
|
||||
#include "../../configuration.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
#include "../common/switch_common.h"
|
||||
|
||||
@ -51,7 +50,6 @@ static void *switch_font_init(void *data, const char *font_path,
|
||||
if (!font_renderer_create_default(&font->font_driver,
|
||||
&font->font_data, font_path, font_size))
|
||||
{
|
||||
RARCH_WARN("Couldn't initialize font renderer.\n");
|
||||
free(font);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -24,7 +24,6 @@
|
||||
|
||||
#include "../font_driver.h"
|
||||
#include "../../configuration.h"
|
||||
#include "../../verbosity.h"
|
||||
#include "../common/vga_common.h"
|
||||
|
||||
typedef struct
|
||||
@ -50,10 +49,7 @@ static void *vga_font_init(void *data,
|
||||
if (!font_renderer_create_default(
|
||||
&font->font_driver,
|
||||
&font->font_data, font_path, font_size))
|
||||
{
|
||||
RARCH_WARN("Couldn't initialize font renderer.\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return font;
|
||||
}
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include "../font_driver.h"
|
||||
|
||||
#include "../../configuration.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@ -86,7 +85,6 @@ static void *vita2d_font_init(void *data,
|
||||
return font;
|
||||
|
||||
error:
|
||||
RARCH_WARN("Couldn't initialize font renderer.\n");
|
||||
free(font);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -85,7 +85,6 @@ static void *vulkan_font_init(void *data,
|
||||
&font->font_driver,
|
||||
&font->font_data, font_path, font_size))
|
||||
{
|
||||
RARCH_WARN("Couldn't initialize font renderer.\n");
|
||||
free(font);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -27,7 +27,6 @@
|
||||
#include "../../wiiu/wiiu_dbg.h"
|
||||
|
||||
#include "../../configuration.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@ -51,7 +50,6 @@ static void* wiiu_font_init(void* data, const char* font_path,
|
||||
&font->font_driver,
|
||||
&font->font_data, font_path, font_size))
|
||||
{
|
||||
RARCH_WARN("Couldn't initialize font renderer.\n");
|
||||
free(font);
|
||||
return NULL;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user