Fix the Texture backend not rendering text the accurate buggy way
A shame I have to fall back on the Surface fallback. Speaking of, I really need to replace that fallback with my software renderer.
This commit is contained in:
parent
defe234ff2
commit
aa728979a3
1 changed files with 7 additions and 11 deletions
|
@ -391,24 +391,20 @@ void Backend_UnloadGlyph(Backend_Glyph *glyph)
|
||||||
|
|
||||||
void Backend_DrawGlyph(Backend_Surface *surface, Backend_Glyph *glyph, long x, long y, const unsigned char *colours)
|
void Backend_DrawGlyph(Backend_Surface *surface, Backend_Glyph *glyph, long x, long y, const unsigned char *colours)
|
||||||
{
|
{
|
||||||
// This is actually slightly imperfect: the SDL_Texture side of things uses alpha, not a colour-key,
|
// The SDL_Texture side of things uses alpha, not a colour-key, so the bug where the font is blended
|
||||||
// so the bug where the font is blended with the colour key doesn't occur. SDL_Textures don't support
|
// with the colour key doesn't occur. SDL_Textures don't support colour-keys, so the next best thing
|
||||||
// colour-keys, so the next best thing is relying on the software fallback, but I don't like the idea
|
// is relying on the software fallback.
|
||||||
// of uploading textures to the GPU every time a glyph is drawn.
|
|
||||||
|
|
||||||
if (glyph == NULL || surface == NULL)
|
if (glyph == NULL || surface == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
RECT rect;
|
SDL_Rect destination_rect = {x, y, glyph->surface->sdl_surface->w, glyph->surface->sdl_surface->h};
|
||||||
rect.left = 0;
|
|
||||||
rect.top = 0;
|
|
||||||
rect.right = glyph->surface->sdl_surface->w;
|
|
||||||
rect.bottom = glyph->surface->sdl_surface->h;
|
|
||||||
|
|
||||||
SDL_SetSurfaceColorMod(glyph->surface->sdl_surface, colours[0], colours[1], colours[2]);
|
SDL_SetSurfaceColorMod(glyph->surface->sdl_surface, colours[0], colours[1], colours[2]);
|
||||||
SDL_SetTextureColorMod(glyph->surface->texture, colours[0], colours[1], colours[2]);
|
SDL_SetSurfaceBlendMode(glyph->surface->sdl_surface, SDL_BLENDMODE_BLEND);
|
||||||
|
SDL_BlitSurface(glyph->surface->sdl_surface, NULL, surface->sdl_surface, &destination_rect);
|
||||||
|
|
||||||
Backend_Blit(glyph->surface, &rect, surface, x, y, TRUE);
|
surface->needs_syncing = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Backend_DrawGlyphToScreen(Backend_Glyph *glyph, long x, long y, const unsigned char *colours)
|
void Backend_DrawGlyphToScreen(Backend_Glyph *glyph, long x, long y, const unsigned char *colours)
|
||||||
|
|
Loading…
Add table
Reference in a new issue