From 3eb5465c933c370f415efdde8e3777484ea4add3 Mon Sep 17 00:00:00 2001 From: Jonas Kulla Date: Tue, 21 Mar 2017 10:57:57 +0100 Subject: [PATCH] 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. --- src/bitmap.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/bitmap.cpp b/src/bitmap.cpp index 8240afe..67538e6 100644 --- a/src/bitmap.cpp +++ b/src/bitmap.cpp @@ -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);