summaryrefslogtreecommitdiff
path: root/src/ui
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-03-31 09:16:13 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-03-31 14:46:52 +0300
commit6cebd826920f2a8164e759bbc02eab67fb2dc1b2 (patch)
tree8d1dfce3bd807e505c2b853d22167571639ee790 /src/ui
parent7bc7a015dfd0d2cc0243114c6bd1379de6461b01 (diff)
Text: Preserve alpha when caching glyphs
Ensure no blending is done. Glyphs are supposed to be cached as-is.
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/text.c3
1 files changed, 3 insertions, 0 deletions
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
481 &d->font, d->xScale, d->yScale, xShift, 0.0f, glyphIndex, &w, &h, 0, 0); 481 &d->font, d->xScale, d->yScale, xShift, 0.0f, glyphIndex, &w, &h, 0, 0);
482 SDL_Surface *surface8 = 482 SDL_Surface *surface8 =
483 SDL_CreateRGBSurfaceWithFormatFrom(bmp, w, h, 8, w, SDL_PIXELFORMAT_INDEX8); 483 SDL_CreateRGBSurfaceWithFormatFrom(bmp, w, h, 8, w, SDL_PIXELFORMAT_INDEX8);
484 SDL_SetSurfaceBlendMode(surface8, SDL_BLENDMODE_NONE);
484 SDL_SetSurfacePalette(surface8, text_.grayscale); 485 SDL_SetSurfacePalette(surface8, text_.grayscale);
485#if LAGRANGE_RASTER_DEPTH != 8 486#if LAGRANGE_RASTER_DEPTH != 8
486 /* Convert to the cache format. */ 487 /* Convert to the cache format. */
487 SDL_Surface *surf = SDL_ConvertSurfaceFormat(surface8, LAGRANGE_RASTER_FORMAT, 0); 488 SDL_Surface *surf = SDL_ConvertSurfaceFormat(surface8, LAGRANGE_RASTER_FORMAT, 0);
489 SDL_SetSurfaceBlendMode(surf, SDL_BLENDMODE_NONE);
488 free(bmp); 490 free(bmp);
489 SDL_FreeSurface(surface8); 491 SDL_FreeSurface(surface8);
490 return surf; 492 return surf;
@@ -728,6 +730,7 @@ void cacheTextGlyphs_Font_(iFont *d, const iRangecc text) {
728 0, bufSize.x, bufSize.y, 730 0, bufSize.x, bufSize.y,
729 LAGRANGE_RASTER_DEPTH, 731 LAGRANGE_RASTER_DEPTH,
730 LAGRANGE_RASTER_FORMAT); 732 LAGRANGE_RASTER_FORMAT);
733 SDL_SetSurfaceBlendMode(buf, SDL_BLENDMODE_NONE);
731 SDL_SetSurfacePalette(buf, text_.grayscale); 734 SDL_SetSurfacePalette(buf, text_.grayscale);
732 } 735 }
733 SDL_Surface *surfaces[2] = { 736 SDL_Surface *surfaces[2] = {