From 6cebd826920f2a8164e759bbc02eab67fb2dc1b2 Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Wed, 31 Mar 2021 09:16:13 +0300 Subject: Text: Preserve alpha when caching glyphs Ensure no blending is done. Glyphs are supposed to be cached as-is. --- src/ui/text.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/ui/text.c b/src/ui/text.c index 325a201f..674e2a72 100644 --- a/src/ui/text.c +++ b/src/ui/text.c @@ -481,10 +481,12 @@ static SDL_Surface *rasterizeGlyph_Font_(const iFont *d, uint32_t glyphIndex, fl &d->font, d->xScale, d->yScale, xShift, 0.0f, glyphIndex, &w, &h, 0, 0); SDL_Surface *surface8 = SDL_CreateRGBSurfaceWithFormatFrom(bmp, w, h, 8, w, SDL_PIXELFORMAT_INDEX8); + SDL_SetSurfaceBlendMode(surface8, SDL_BLENDMODE_NONE); SDL_SetSurfacePalette(surface8, text_.grayscale); #if LAGRANGE_RASTER_DEPTH != 8 /* Convert to the cache format. */ SDL_Surface *surf = SDL_ConvertSurfaceFormat(surface8, LAGRANGE_RASTER_FORMAT, 0); + SDL_SetSurfaceBlendMode(surf, SDL_BLENDMODE_NONE); free(bmp); SDL_FreeSurface(surface8); return surf; @@ -728,6 +730,7 @@ void cacheTextGlyphs_Font_(iFont *d, const iRangecc text) { 0, bufSize.x, bufSize.y, LAGRANGE_RASTER_DEPTH, LAGRANGE_RASTER_FORMAT); + SDL_SetSurfaceBlendMode(buf, SDL_BLENDMODE_NONE); SDL_SetSurfacePalette(buf, text_.grayscale); } SDL_Surface *surfaces[2] = { -- cgit v1.2.3