ref: f9e96e2608b3c2e1f9027c1dba5de5ff2a592e68
parent: a14aa30bde008fe40c6a6f846a0c5e687b7c249f
author: Clownacy <[email protected]>
date: Wed Oct 21 15:09:20 EDT 2020
3DS: Fix text transparency RenderBackend_UploadGlyph calls EndRendering, and BeginRendering isn't called before RenderBackend_DrawGlyph runs.
--- a/src/Backends/Rendering/3DS.cpp
+++ b/src/Backends/Rendering/3DS.cpp
@@ -38,6 +38,7 @@
} RenderBackend_GlyphAtlas;
static RenderBackend_GlyphAtlas *glyph_atlas;
+static RenderBackend_Surface *glyph_destination_surface;
static C2D_ImageTint glyph_tint;
static C3D_RenderTarget *screen_render_target;
@@ -447,11 +448,8 @@
{
EnableAlpha(true);
- BeginRendering();
-
- SelectRenderTarget(destination_surface->render_target);
-
glyph_atlas = atlas;
+ glyph_destination_surface = destination_surface;
C2D_PlainImageTint(&glyph_tint, C2D_Color32(red, green, blue, 0xFF), 1.0f);
}
@@ -458,6 +456,10 @@
void RenderBackend_DrawGlyph(long x, long y, size_t glyph_x, size_t glyph_y, size_t glyph_width, size_t glyph_height)
{
+ BeginRendering();
+
+ SelectRenderTarget(glyph_destination_surface->render_target);
+
const float texture_left = (float)glyph_x / glyph_atlas->texture.width;
const float texture_top = (float)(glyph_atlas->texture.height - glyph_y) / glyph_atlas->texture.height;
const float texture_right = (float)(glyph_x + glyph_width) / glyph_atlas->texture.width;