Skip to content

Commit

Permalink
Fix Sphere v1 Font#drawZoomedText()
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
fatcerberus committed Apr 2, 2017
1 parent 70686f5 commit 6d6dca5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/minisphere/vanilla.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 6d6dca5

Please sign in to comment.