From eaf4bd5e663bfa667d2712cb018d941cf7b8013b Mon Sep 17 00:00:00 2001 From: RadialApps Date: Tue, 8 Aug 2017 16:27:42 +0530 Subject: [PATCH] Disable alpha and don't add text to tainted area While definitely not recommendable, this improves performance drastically while rendering text on many devices, especially when lots of text is render one character at a time. --- src/bitmap.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/bitmap.cpp b/src/bitmap.cpp index 96cd968..0bad361 100644 --- a/src/bitmap.cpp +++ b/src/bitmap.cpp @@ -1079,7 +1079,8 @@ void Bitmap::drawText(const IntRect &rect, const char *str, int align) Vec2i gpTexSize; shState->ensureTexSize(txtSurf->w, txtSurf->h, gpTexSize); - bool fastBlit = !p->touchesTaintedArea(posRect) && txtAlpha == 1.0f; + /* Disable alpha for more performance*/ + bool fastBlit = !p->touchesTaintedArea(posRect); //&& txtAlpha == 1.0f; if (fastBlit) { @@ -1196,7 +1197,8 @@ void Bitmap::drawText(const IntRect &rect, const char *str, int align) } SDL_FreeSurface(txtSurf); - p->addTaintedArea(posRect); + /* Remove this for a performance advantage, with a risk */ + /* p->addTaintedArea(posRect); */ p->onModified(); }