summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-12-30 15:02:21 +0300
committerAndrei Karas <akaras@inbox.ru>2013-12-30 15:02:21 +0300
commit6872cb2a97571258e5b4ef863eccd8ceec00f58a (patch)
treecbb2d9b7440618a92e24229986e79680119786bc
parent31fcdb31fb406531bec49ee2d1b3cc286ed3b5a8 (diff)
downloadplus-6872cb2a97571258e5b4ef863eccd8ceec00f58a.tar.gz
plus-6872cb2a97571258e5b4ef863eccd8ceec00f58a.tar.bz2
plus-6872cb2a97571258e5b4ef863eccd8ceec00f58a.tar.xz
plus-6872cb2a97571258e5b4ef863eccd8ceec00f58a.zip
Improve drawImageRect in renderers.
-rw-r--r--src/render/graphics.cpp31
-rw-r--r--src/render/graphics.h17
2 files changed, 14 insertions, 34 deletions
diff --git a/src/render/graphics.cpp b/src/render/graphics.cpp
index cd2332d19..05baa9d64 100644
--- a/src/render/graphics.cpp
+++ b/src/render/graphics.cpp
@@ -442,17 +442,21 @@ int Graphics::getHeight() const
void Graphics::drawImageRect(const int x, const int y,
const int w, const int h,
- const Image *const topLeft,
- const Image *const topRight,
- const Image *const bottomLeft,
- const Image *const bottomRight,
- const Image *const top,
- const Image *const right,
- const Image *const bottom,
- const Image *const left,
- const Image *const center)
+ const ImageRect &imgRect)
{
BLOCK_START("Graphics::drawImageRect")
+
+ const Image *const *const grid = imgRect.grid;
+ const Image *const topLeft = grid[0];
+ const Image *const topRight = grid[2];
+ const Image *const bottomLeft = grid[6];
+ const Image *const bottomRight = grid[8];
+ const Image *const top = grid[1];
+ const Image *const right = grid[5];
+ const Image *const bottom = grid[7];
+ const Image *const left = grid[3];
+ const Image *const center = grid[4];
+
const bool drawMain = center && topLeft && topRight
&& bottomLeft && bottomRight;
@@ -500,15 +504,6 @@ void Graphics::drawImageRect(const int x, const int y,
BLOCK_END("Graphics::drawImageRect")
}
-void Graphics::drawImageRect(int x, int y, int w, int h,
- const ImageRect &imgRect)
-{
- drawImageRect(x, y, w, h,
- imgRect.grid[0], imgRect.grid[2], imgRect.grid[6], imgRect.grid[8],
- imgRect.grid[1], imgRect.grid[5], imgRect.grid[7], imgRect.grid[3],
- imgRect.grid[4]);
-}
-
bool Graphics::drawNet(const int x1, const int y1, const int x2, const int y2,
const int width, const int height)
{
diff --git a/src/render/graphics.h b/src/render/graphics.h
index e1d4f1ec4..93d2c5276 100644
--- a/src/render/graphics.h
+++ b/src/render/graphics.h
@@ -145,7 +145,7 @@ class Graphics : public gcn::Graphics
void drawImage(const gcn::Image* image A_UNUSED,
int srcX A_UNUSED, int srcY A_UNUSED,
int dstX A_UNUSED, int dstY A_UNUSED,
- int width A_UNUSED, int height A_UNUSED) override
+ int width A_UNUSED, int height A_UNUSED) override final
{
}
@@ -174,21 +174,6 @@ class Graphics : public gcn::Graphics
* Draws a rectangle using images. 4 corner images, 4 side images and 1
* image for the inside.
*/
- void drawImageRect(const int x, const int y, const int w, const int h,
- const Image *const topLeft,
- const Image *const topRight,
- const Image *const bottomLeft,
- const Image *const bottomRight,
- const Image *const top,
- const Image *const right,
- const Image *const bottom,
- const Image *const left,
- const Image *const center);
-
- /**
- * Draws a rectangle using images. 4 corner images, 4 side images and 1
- * image for the inside.
- */
void drawImageRect(int x, int y, int w, int h,
const ImageRect &imgRect);