(GL1/GL2 Raster fonts) remove dead code

This commit is contained in:
libretroadmin 2022-07-08 22:46:03 +02:00
parent 7f3930b71b
commit 81de36e1ff
2 changed files with 4 additions and 95 deletions

View File

@ -78,41 +78,6 @@ static void gl1_raster_font_free(void *data,
free(font);
}
#if 0
static bool gl1_raster_font_upload_atlas(gl1_raster_t *font)
{
unsigned i, j;
GLint gl_internal = GL_RGBA;
GLenum gl_format = GL_RGBA;
size_t ncomponents = 4;
uint8_t *tmp = NULL;
tmp = (uint8_t*)calloc(font->tex_height, font->tex_width * ncomponents);
for (i = 0; i < font->atlas->height; ++i)
{
const uint8_t *src = &font->atlas->buffer[i * font->atlas->width];
uint8_t *dst = &tmp[i * font->tex_width * ncomponents];
for (j = 0; j < font->atlas->width; ++j)
{
*dst++ = 0xff;
*dst++ = 0xff;
*dst++ = 0xff;
*dst++ = *src++;
}
break;
}
glTexImage2D(GL_TEXTURE_2D, 0, gl_internal, font->tex_width, font->tex_height,
0, gl_format, GL_UNSIGNED_BYTE, tmp);
free(tmp);
return true;
}
#endif
static bool gl1_raster_font_upload_atlas(gl1_raster_t *font)
{
unsigned i, j;
@ -172,13 +137,10 @@ static void *gl1_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;
}
RARCH_LOG("[Font]: Using font driver GL1\n");
if (is_threaded)
if (
font->gl &&

View File

@ -83,65 +83,13 @@ static void gl2_raster_font_free(void *data,
free(font);
}
#if 0
static bool gl2_raster_font_upload_atlas_components_4(gl2_raster_t *font)
{
unsigned i, j;
GLint gl_internal = GL_RGBA;
GLenum gl_format = GL_RGBA;
size_t ncomponents = 4;
uint8_t *tmp = (uint8_t*)
calloc(font->tex_height, font->tex_width * ncomponents);
for (i = 0; i < font->atlas->height; ++i)
{
const uint8_t *src = &font->atlas->buffer[i * font->atlas->width];
uint8_t *dst = &tmp[i * font->tex_width * ncomponents];
for (j = 0; j < font->atlas->width; ++j)
{
*dst++ = 0xff;
*dst++ = 0xff;
*dst++ = 0xff;
*dst++ = *src++;
}
break;
}
glTexImage2D(GL_TEXTURE_2D, 0, gl_internal,
font->tex_width, font->tex_height,
0, gl_format, GL_UNSIGNED_BYTE, tmp);
free(tmp);
return true;
}
#endif
static bool gl2_raster_font_upload_atlas(gl2_raster_t *font)
{
unsigned i, j;
GLint gl_internal = GL_LUMINANCE_ALPHA;
GLenum gl_format = GL_LUMINANCE_ALPHA;
size_t ncomponents = 2;
uint8_t *tmp = NULL;
#if defined(GL_VERSION_3_0)
struct retro_hw_render_callback *hwr = video_driver_get_hw_context();
if ((font->gl && font->gl->core_context_in_use) ||
(hwr->context_type == RETRO_HW_CONTEXT_OPENGL &&
hwr->version_major >= 3))
{
GLint swizzle[] = { GL_ONE, GL_ONE, GL_ONE, GL_RED };
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzle);
gl_internal = GL_R8;
gl_format = GL_RED;
ncomponents = 1;
}
#endif
tmp = (uint8_t*)calloc(font->tex_height, font->tex_width * ncomponents);
GLint gl_internal = GL_LUMINANCE_ALPHA;
GLenum gl_format = GL_LUMINANCE_ALPHA;
size_t ncomponents = 2;
uint8_t *tmp = (uint8_t*)calloc(font->tex_height, font->tex_width * ncomponents);
switch (ncomponents)
{
@ -193,7 +141,6 @@ static void *gl2_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;
}