Bitmap: Prevent one-pixel squeeze

This likely happens because the game doesn't take the shadow
into account, and specifies the target rectangle one pixel too
narrow.
This commit is contained in:
Jonas Kulla 2017-03-21 10:57:57 +01:00
parent ef06c8eca4
commit 3eb5465c93
1 changed files with 3 additions and 1 deletions

View File

@ -1186,7 +1186,9 @@ void Bitmap::drawText(const IntRect &rect, const char *str, int align)
float squeeze = (float) rect.w / txtSurf->w;
if (squeeze > 1)
// If we're off by one pixel, it's likely that some bitmap was allocated
// without taking the shadow size into account
if (squeeze > 1 || txtSurf->w - rect.w == 1)
squeeze = 1;
FloatRect posRect(alignX, alignY, txtSurf->w * squeeze, txtSurf->h);