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.
This commit is contained in:
RadialApps 2017-08-08 16:27:42 +05:30 committed by Varun Patil
parent 559b026b19
commit eaf4bd5e66
1 changed files with 4 additions and 2 deletions

View File

@ -1079,7 +1079,8 @@ void Bitmap::drawText(const IntRect &rect, const char *str, int align)
Vec2i gpTexSize; Vec2i gpTexSize;
shState->ensureTexSize(txtSurf->w, txtSurf->h, 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) if (fastBlit)
{ {
@ -1196,7 +1197,8 @@ void Bitmap::drawText(const IntRect &rect, const char *str, int align)
} }
SDL_FreeSurface(txtSurf); SDL_FreeSurface(txtSurf);
p->addTaintedArea(posRect); /* Remove this for a performance advantage, with a risk */
/* p->addTaintedArea(posRect); */
p->onModified(); p->onModified();
} }