summaryrefslogtreecommitdiff
path: root/src/ui/text.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/text.c')
-rw-r--r--src/ui/text.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/ui/text.c b/src/ui/text.c
index f947c4df..52af34bb 100644
--- a/src/ui/text.c
+++ b/src/ui/text.c
@@ -306,10 +306,11 @@ static void cache_Font_(iFont *d, iGlyph *glyph, int hoff) {
306 } 306 }
307 /* Determine placement in the glyph cache texture, advancing in rows. */ 307 /* Determine placement in the glyph cache texture, advancing in rows. */
308 glRect->pos = assignCachePos_Text_(txt, glRect->size); 308 glRect->pos = assignCachePos_Text_(txt, glRect->size);
309 SDL_Texture *oldTarget = SDL_GetRenderTarget(render);
309 SDL_SetRenderTarget(render, txt->cache); 310 SDL_SetRenderTarget(render, txt->cache);
310 const SDL_Rect dstRect = sdlRect_(*glRect); 311 const SDL_Rect dstRect = sdlRect_(*glRect);
311 SDL_RenderCopy(render, tex, &(SDL_Rect){ 0, 0, dstRect.w, dstRect.h }, &dstRect); 312 SDL_RenderCopy(render, tex, &(SDL_Rect){ 0, 0, dstRect.w, dstRect.h }, &dstRect);
312 SDL_SetRenderTarget(render, NULL); 313 SDL_SetRenderTarget(render, oldTarget);
313 if (tex) { 314 if (tex) {
314 SDL_DestroyTexture(tex); 315 SDL_DestroyTexture(tex);
315 iAssert(surface); 316 iAssert(surface);
@@ -670,9 +671,10 @@ void init_TextBuf(iTextBuf *d, int font, const char *text) {
670 d->size.x, 671 d->size.x,
671 d->size.y); 672 d->size.y);
672 SDL_SetTextureBlendMode(d->texture, SDL_BLENDMODE_BLEND); 673 SDL_SetTextureBlendMode(d->texture, SDL_BLENDMODE_BLEND);
674 SDL_Texture *oldTarget = SDL_GetRenderTarget(render);
673 SDL_SetRenderTarget(render, d->texture); 675 SDL_SetRenderTarget(render, d->texture);
674 draw_Text_(font, zero_I2(), white_ColorId, range_CStr(text)); 676 draw_Text_(font, zero_I2(), white_ColorId, range_CStr(text));
675 SDL_SetRenderTarget(render, NULL); 677 SDL_SetRenderTarget(render, oldTarget);
676} 678}
677 679
678void deinit_TextBuf(iTextBuf *d) { 680void deinit_TextBuf(iTextBuf *d) {