diff options
author | frosch <frosch@openttd.org> | 2011-07-02 14:37:03 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2011-07-02 14:37:03 +0000 |
commit | 1bc1a42ea57c038df25f2e538bea77fa5451c30d (patch) | |
tree | 53a4c42bf75225b191967ca5a0c69f5300ed6ec2 /src/gfx.cpp | |
parent | c544dca5191112bf8a21acff36833c081d304291 (diff) | |
download | openttd-1bc1a42ea57c038df25f2e538bea77fa5451c30d.tar.xz |
(svn r22619) -Fix [FS#4662]: Consider the size of the vehicle sprite for the lineheight in the company GUI. This also makes the widget containing the sprite not skip drawing it, if the bounds of the widget are outside of the drawing area though the sprite actually needs drawing.
Diffstat (limited to 'src/gfx.cpp')
-rw-r--r-- | src/gfx.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/gfx.cpp b/src/gfx.cpp index 5862e7ee0..300a33ecf 100644 --- a/src/gfx.cpp +++ b/src/gfx.cpp @@ -1116,13 +1116,19 @@ skip_cont:; /** * Get the size of a sprite. * @param sprid Sprite to examine. + * @param [out] offset Optionally returns the sprite position offset. * @return Sprite size in pixels. * @note The size assumes (0, 0) as top-left coordinate and ignores any part of the sprite drawn at the left or above that position. */ -Dimension GetSpriteSize(SpriteID sprid) +Dimension GetSpriteSize(SpriteID sprid, Point *offset) { const Sprite *sprite = GetSprite(sprid, ST_NORMAL); + if (offset != NULL) { + offset->x = sprite->x_offs; + offset->y = sprite->y_offs; + } + Dimension d; d.width = max<int>(0, sprite->x_offs + sprite->width); d.height = max<int>(0, sprite->y_offs + sprite->height); |