delimiter test is based on existing ppc macros

This commit is contained in:
2026-09-21 18:56:23 -05:00
parent 98406ea33e
commit b1f0376f35

View File

@@ -18,7 +18,11 @@
ALLEGRO_DEBUG_CHANNEL("font") ALLEGRO_DEBUG_CHANNEL("font")
#define CANI_ALLEGRO_SCHRIFT_VER 1 #define CANI_ALLEGRO_SCHRIFT_VER 1
#define delimit_color al_map_rgba(0, 0, 255, 255) #define delimit_red 0
#define delimit_green 0
#define delimit_blue 255
#define delimit_alpha 255
#define delimit_color al_map_rgba(delimit_red, delimit_green, delimit_blue, delimit_alpha)
/* globals */ /* globals */
static bool ttf_inited; static bool ttf_inited;
@@ -180,7 +184,12 @@ ALLEGRO_FONT *al_load_ttf_font_f(ALLEGRO_FILE *file,
unsigned int pixiw = 0, pixih = 0, pixi = 0; unsigned int pixiw = 0, pixih = 0, pixi = 0;
while (pixi < gtexh * gtexw) { while (pixi < gtexh * gtexw) {
uint32_t* pixel = (uint32_t*)((uint8_t*)glock->data + (glock->pitch * (signed)pixih)) + pixiw; uint32_t* pixel = (uint32_t*)((uint8_t*)glock->data + (glock->pitch * (signed)pixih)) + pixiw;
if (*pixel == 0xFFFF0000) *pixel = 0xFF000000; constexpr uint32_t delimiter =
delimit_alpha << 24
| delimit_blue << 16
| delimit_green << 8
| delimit_red;
if (*pixel == delimiter) *pixel = 0xFF000000;
else *pixel = (*pixel & 0xffu) * 0x01010101u; else *pixel = (*pixel & 0xffu) * 0x01010101u;
pixi++; pixi++;
if (++pixiw >= gtexw) { if (++pixiw >= gtexw) {