summaryrefslogtreecommitdiff
path: root/src/render/graphics.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-12-22 19:59:00 +0300
committerAndrei Karas <akaras@inbox.ru>2013-12-22 19:59:00 +0300
commit2425f9821deb57ceab2f6e6a5aa01a0784e07148 (patch)
tree53344f83d28f974bc2c125d405e227a5121f12ac /src/render/graphics.cpp
parentd7131239c18eafecef2e8b8fa6898ba9962ff0e8 (diff)
downloadmanaplus-2425f9821deb57ceab2f6e6a5aa01a0784e07148.tar.gz
manaplus-2425f9821deb57ceab2f6e6a5aa01a0784e07148.tar.bz2
manaplus-2425f9821deb57ceab2f6e6a5aa01a0784e07148.tar.xz
manaplus-2425f9821deb57ceab2f6e6a5aa01a0784e07148.zip
allow correct draw control background if width smaller than some image sizes.
Diffstat (limited to 'src/render/graphics.cpp')
-rw-r--r--src/render/graphics.cpp36
1 files changed, 27 insertions, 9 deletions
diff --git a/src/render/graphics.cpp b/src/render/graphics.cpp
index 8508b9eec..fc8be7509 100644
--- a/src/render/graphics.cpp
+++ b/src/render/graphics.cpp
@@ -489,17 +489,26 @@ void Graphics::drawImageRect(const int x, const int y,
drawImagePattern(top, x + lw, y, w - lw - rw, th);
drawImagePattern(bottom, x + lw, h - bh + y, w - lw - rw, bh);
drawImagePattern(left, x, y + th, lw, h - th - bh);
- drawImagePattern(right, x + w - rw, th + y, rw, h - th - bh);
+ if (w > rw)
+ drawImagePattern(right, x + w - rw, th + y, rw, h - th - bh);
}
// Draw the corners
if (drawMain)
{
DRAW_IMAGE(this, topLeft, x, y);
- DRAW_IMAGE(this, topRight, x + w - topRight->getWidth(), y);
+ const int trw = topRight->getWidth();
+ if (w > trw)
+ {
+ DRAW_IMAGE(this, topRight, x + w - trw, y);
+ }
DRAW_IMAGE(this, bottomLeft, x, h - bottomLeft->getHeight() + y);
- DRAW_IMAGE(this, bottomRight,
- x + w - bottomRight->getWidth(),
- y + h - bottomRight->getHeight());
+ const int brw = bottomRight->getWidth();
+ if (w > brw)
+ {
+ DRAW_IMAGE(this, bottomRight,
+ x + w - brw,
+ y + h - bottomRight->getHeight());
+ }
}
BLOCK_END("Graphics::drawImageRect")
}
@@ -566,18 +575,27 @@ bool Graphics::calcImageRect(ImageVertexes *const vert,
calcImagePattern(vert, top, x + lw, y, w - lw - rw, th);
calcImagePattern(vert, bottom, x + lw, y + h - bh, w - lw - rw, bh);
calcImagePattern(vert, left, x, y + th, lw, h - th - bh);
- calcImagePattern(vert, right, x + w - rw, y + th, rw, h - th - bh);
+ if (w > rw)
+ calcImagePattern(vert, right, x + w - rw, y + th, rw, h - th - bh);
}
calcTileVertexes(vert, topLeft, x, y);
if (topRight)
- calcTileVertexes(vert, topRight, x + w - topRight->getWidth(), y);
+ {
+ const int trw = topRight->getWidth();
+ if (w > trw)
+ calcTileVertexes(vert, topRight, x + w - trw, y);
+ }
if (bottomLeft)
calcTileVertexes(vert, bottomLeft, x, y + h - bottomLeft->getHeight());
if (bottomRight)
{
- calcTileVertexes(vert, bottomRight, x + w - bottomRight->getWidth(),
- y + h - bottomRight->getHeight());
+ const int brw = bottomRight->getWidth();
+ if (w > brw)
+ {
+ calcTileVertexes(vert, bottomRight, x + w - brw,
+ y + h - bottomRight->getHeight());
+ }
}
// popClipArea();