Fix color of rendered text for Solaris

This commit is contained in:
John Lorentzson 2025-04-26 14:17:03 +02:00
parent a4479f9c07
commit 719937c06f

View file

@ -39,7 +39,7 @@ static RenderBackend_Surface framebuffer;
static RenderBackend_GlyphAtlas *glyph_atlas;
static RenderBackend_Surface *glyph_destination_surface;
static unsigned char glyph_colour_channels[3];
static unsigned char glyph_colour_channels[4];
RenderBackend_Surface* RenderBackend_Init(const char *window_title, size_t screen_width, size_t screen_height, bool fullscreen)
{
@ -421,9 +421,17 @@ void RenderBackend_PrepareToDrawGlyphs(RenderBackend_GlyphAtlas *atlas, RenderBa
glyph_atlas = atlas;
glyph_destination_surface = destination_surface;
glyph_colour_channels[0] = red;
#ifdef LITTLE_ENDIAN
glyph_colour_channels[0] = blue;
glyph_colour_channels[1] = green;
glyph_colour_channels[2] = blue;
glyph_colour_channels[2] = red;
//glyph_colour_channels[3] = 0;
#else
//glyph_colour_channels[0] = 0;
glyph_colour_channels[1] = blue;
glyph_colour_channels[2] = green;
glyph_colour_channels[3] = red;
#endif
}
void RenderBackend_DrawGlyph(long x, long y, size_t glyph_x, size_t glyph_y, size_t glyph_width, size_t glyph_height)
@ -487,7 +495,7 @@ void RenderBackend_DrawGlyph(long x, long y, size_t glyph_x, size_t glyph_y, siz
unsigned char *bitmap_pixel = &glyph_destination_surface->pixels[(surface_y + iy) * glyph_destination_surface->pitch + (surface_x + ix) * 4];
for (unsigned int j = 0; j < 3; ++j)
for (unsigned int j = 0; j < 4; ++j)
bitmap_pixel[j] = (unsigned char)((glyph_colour_channels[j] * alpha) + (bitmap_pixel[j] * (1.0f - alpha))); // Alpha blending
}
}