From 536f25412270d4ca31e46d1bdd8b13631022f02e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jaakko=20Ker=C3=A4nen?= jaakko.keranen@iki.fi
Date: Wed, 31 Mar 2021 09:16:13 +0300
Subject: [PATCH 1/1] 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(+)
diff --git a/src/ui/text.c b/src/ui/text.c
index dd5c5e4c..8c98cd03 100644
--- a/src/ui/text.c
+++ b/src/ui/text.c
@@ -483,10 +483,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_SetSurfacePalette(surface8, text_.grayscale);
#if LAGRANGE_RASTER_DEPTH != 8
/* Convert to the cache format. */
SDL_Surface *surf = SDL_ConvertSurfaceFormat(surface8, LAGRANGE_RASTER_FORMAT, 0);
free(bmp);
SDL_FreeSurface(surface8);
return surf;
@@ -730,6 +732,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] = {
--
2.25.1
text/plain
This content has been proxied by September (ba2dc).