From 6d6dca5d32543411a561cee3abcecf78e6bc4624 Mon Sep 17 00:00:00 2001 From: Bruce Pascoe Date: Sun, 2 Apr 2017 10:55:28 -0400 Subject: [PATCH] Fix Sphere v1 Font#drawZoomedText() The font's alpha channel was lost due to not setting the blend mode properly before rendering text. Honestly the way this is implemented is pretty inefficient, but I couldn't come up with a better way to do it. Probably not worth the trouble at this point since Sphere v1 is deprecated anyway. --- CHANGELOG.md | 5 +++-- src/minisphere/vanilla.c | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b1c86c920..75d8b089a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,9 @@ miniSphere Changelog vX.X.X - TBD ------------ -* Fixes a long-standing bug in the RFN font loader that caused RFNv1 fonts to - be rendered without transparency. +* Fixes a bug where Sphere v1 `drawZoomedText()` ignores non-opaque pixels. +* Fixes a bug in the RFN font loader where RFNv1 (grayscale) fonts are loaded + without an alpha channel. v4.5.9 - March 31, 2017 diff --git a/src/minisphere/vanilla.c b/src/minisphere/vanilla.c index 271372df6..3177b6acb 100644 --- a/src/minisphere/vanilla.c +++ b/src/minisphere/vanilla.c @@ -3084,10 +3084,12 @@ js_Font_drawZoomedText(duk_context* ctx) if (!screen_is_skipframe(g_screen)) { text_w = font_get_width(font, text); text_h = font_height(font); + apply_blend_mode(BLEND_REPLACE); bitmap = al_create_bitmap(text_w, text_h); al_set_target_bitmap(bitmap); font_draw_text(font, mask, 0, 0, TEXT_ALIGN_LEFT, text); al_set_target_backbuffer(screen_display(g_screen)); + reset_blender(); al_draw_scaled_bitmap(bitmap, 0, 0, text_w, text_h, x, y, text_w * scale, text_h * scale, 0x0); al_destroy_bitmap(bitmap); }