mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-13 02:52:37 +00:00
(svn r25478) -Fix: Clip glyphs using the actual sprite dimensions instead of the text advancement.
This commit is contained in:
parent
809120bc05
commit
653a005d19
10
src/gfx.cpp
10
src/gfx.cpp
@ -463,7 +463,7 @@ static int DrawLayoutLine(ParagraphLayout::Line *line, int y, int left, int righ
|
|||||||
|
|
||||||
DrawPixelInfo *dpi = _cur_dpi;
|
DrawPixelInfo *dpi = _cur_dpi;
|
||||||
int dpi_left = dpi->left;
|
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;
|
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;
|
int top = run->getPositions()[i * 2 + 1] + y;
|
||||||
|
|
||||||
/* Truncated away. */
|
/* Truncated away. */
|
||||||
if (begin_x < min_x || end_x > max_x) continue;
|
if (truncation && (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;
|
|
||||||
|
|
||||||
const Sprite *sprite = fc->GetGlyph(glyph);
|
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) {
|
if (draw_shadow && (glyph & SPRITE_GLYPH) == 0) {
|
||||||
SetColourRemap(TC_BLACK);
|
SetColourRemap(TC_BLACK);
|
||||||
GfxMainBlitter(sprite, begin_x + 1, top + 1, BM_COLOUR_REMAP);
|
GfxMainBlitter(sprite, begin_x + 1, top + 1, BM_COLOUR_REMAP);
|
||||||
|
Loading…
Reference in New Issue
Block a user