From 6872cb2a97571258e5b4ef863eccd8ceec00f58a Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 30 Dec 2013 15:02:21 +0300 Subject: Improve drawImageRect in renderers. --- src/render/graphics.cpp | 31 +++++++++++++------------------ src/render/graphics.h | 17 +---------------- 2 files changed, 14 insertions(+), 34 deletions(-) (limited to 'src/render') 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 { } @@ -170,21 +170,6 @@ class Graphics : public gcn::Graphics const int scaledWidth, const int scaledHeight) = 0; - /** - * 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. -- cgit v1.2.3-70-g09d2