summaryrefslogtreecommitdiff
path: root/src/gfx.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2013-06-26 19:35:40 +0000
committerfrosch <frosch@openttd.org>2013-06-26 19:35:40 +0000
commit653a005d1996f735ba0f25e910530793cb7a6729 (patch)
tree6a26ba07159e698cfa61c33ebaf5dd38d54a264a /src/gfx.cpp
parent809120bc05124847a0e33e069bbe0c09b995866e (diff)
downloadopenttd-653a005d1996f735ba0f25e910530793cb7a6729.tar.xz
(svn r25478) -Fix: Clip glyphs using the actual sprite dimensions instead of the text advancement.
Diffstat (limited to 'src/gfx.cpp')
-rw-r--r--src/gfx.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/gfx.cpp b/src/gfx.cpp
index da8215fec..54a851221 100644
--- a/src/gfx.cpp
+++ b/src/gfx.cpp
@@ -463,7 +463,7 @@ static int DrawLayoutLine(ParagraphLayout::Line *line, int y, int left, int righ
DrawPixelInfo *dpi = _cur_dpi;
int dpi_left = dpi->left;
- int dpi_right = dpi->left + dpi->width;
+ int dpi_right = dpi->left + dpi->width - 1;
bool draw_shadow = fc->GetDrawGlyphShadow() && colour != TC_BLACK;
@@ -478,12 +478,12 @@ static int DrawLayoutLine(ParagraphLayout::Line *line, int y, int left, int righ
int top = run->getPositions()[i * 2 + 1] + y;
/* Truncated away. */
- if (begin_x < min_x || end_x > max_x) continue;
-
- /* Not within the bounds to draw. */
- if (begin_x >= dpi_right || end_x <= dpi_left) continue;
+ if (truncation && (begin_x < min_x || end_x > max_x)) continue;
const Sprite *sprite = fc->GetGlyph(glyph);
+ /* Check clipping (the "+ 1" is for the shadow). */
+ if (begin_x + sprite->x_offs > dpi_right || begin_x + sprite->x_offs + sprite->width /* - 1 + 1 */ < dpi_left) continue;
+
if (draw_shadow && (glyph & SPRITE_GLYPH) == 0) {
SetColourRemap(TC_BLACK);
GfxMainBlitter(sprite, begin_x + 1, top + 1, BM_COLOUR_REMAP);