diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-12-30 17:04:01 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-12-30 17:04:01 +0300 |
commit | 6356ac19cd30dd2774de08834ec6b7afba54a3c8 (patch) | |
tree | ec8667e401f603c88a2f64357433336e867a6a0f /src | |
parent | f98e1eb985bd5d694cd8fce323e5f4c3767dfe71 (diff) | |
download | plus-6356ac19cd30dd2774de08834ec6b7afba54a3c8.tar.gz plus-6356ac19cd30dd2774de08834ec6b7afba54a3c8.tar.bz2 plus-6356ac19cd30dd2774de08834ec6b7afba54a3c8.tar.xz plus-6356ac19cd30dd2774de08834ec6b7afba54a3c8.zip |
Improve calcImageRect in renderers.
Diffstat (limited to 'src')
-rw-r--r-- | src/render/graphics.cpp | 22 | ||||
-rw-r--r-- | src/render/graphics.h | 10 | ||||
-rw-r--r-- | src/render/mobileopenglgraphics.cpp | 5 | ||||
-rw-r--r-- | src/render/normalopenglgraphics.cpp | 5 | ||||
-rw-r--r-- | src/render/nullopenglgraphics.cpp | 5 | ||||
-rw-r--r-- | src/render/sdl2graphics.cpp | 5 | ||||
-rw-r--r-- | src/render/sdl2softwaregraphics.cpp | 5 | ||||
-rw-r--r-- | src/render/sdlgraphics.cpp | 5 |
8 files changed, 20 insertions, 42 deletions
diff --git a/src/render/graphics.cpp b/src/render/graphics.cpp index 3e8f2c46a..c83595b56 100644 --- a/src/render/graphics.cpp +++ b/src/render/graphics.cpp @@ -519,20 +519,24 @@ bool Graphics::drawNet(const int x1, const int y1, const int x2, const int y2, bool Graphics::calcImageRect(ImageVertexes *const vert, 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) { if (!vert) return false; BLOCK_START("Graphics::calcImageRect") + + 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; diff --git a/src/render/graphics.h b/src/render/graphics.h index 93d2c5276..93b2977d6 100644 --- a/src/render/graphics.h +++ b/src/render/graphics.h @@ -180,15 +180,7 @@ class Graphics : public gcn::Graphics bool calcImageRect(ImageVertexes *const vert, 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); virtual void calcPattern(ImageVertexes *const vert, const Image *const image, diff --git a/src/render/mobileopenglgraphics.cpp b/src/render/mobileopenglgraphics.cpp index bec9c221c..5efcd8060 100644 --- a/src/render/mobileopenglgraphics.cpp +++ b/src/render/mobileopenglgraphics.cpp @@ -784,10 +784,7 @@ bool MobileOpenGLGraphics::calcWindow(ImageCollection *const vertCol, vert = vertCol->currentVert; } - return calcImageRect(vert, 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]); + return calcImageRect(vert, x, y, w, h, imgRect); } void MobileOpenGLGraphics::updateScreen() diff --git a/src/render/normalopenglgraphics.cpp b/src/render/normalopenglgraphics.cpp index ea1bd7242..5f24eda2c 100644 --- a/src/render/normalopenglgraphics.cpp +++ b/src/render/normalopenglgraphics.cpp @@ -1040,10 +1040,7 @@ bool NormalOpenGLGraphics::calcWindow(ImageCollection *const vertCol, } const Image *const *const grid = &imgRect.grid[0]; - return calcImageRect(vert, x, y, w, h, - grid[0], grid[2], grid[6], grid[8], - grid[1], grid[5], grid[7], grid[3], - grid[4]); + return calcImageRect(vert, x, y, w, h, imgRect); } void NormalOpenGLGraphics::updateScreen() diff --git a/src/render/nullopenglgraphics.cpp b/src/render/nullopenglgraphics.cpp index 3ad9b9e83..da9163294 100644 --- a/src/render/nullopenglgraphics.cpp +++ b/src/render/nullopenglgraphics.cpp @@ -874,10 +874,7 @@ bool NullOpenGLGraphics::calcWindow(ImageCollection *const vertCol, vert = vertCol->currentVert; } - return calcImageRect(vert, 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]); + return calcImageRect(vert, x, y, w, h, imgRect); } void NullOpenGLGraphics::updateScreen() diff --git a/src/render/sdl2graphics.cpp b/src/render/sdl2graphics.cpp index 45f09f0f7..dfa9cfb3f 100644 --- a/src/render/sdl2graphics.cpp +++ b/src/render/sdl2graphics.cpp @@ -564,10 +564,7 @@ bool SDLGraphics::calcWindow(ImageCollection *const vertCol, } const Image *const *const grid = &imgRect.grid[0]; - return calcImageRect(vert, x, y, w, h, - grid[0], grid[2], grid[6], grid[8], - grid[1], grid[5], grid[7], grid[3], - grid[4]); + return calcImageRect(vert, x, y, w, h, imgRect); } void SDLGraphics::fillRectangle(const gcn::Rectangle &rectangle) diff --git a/src/render/sdl2softwaregraphics.cpp b/src/render/sdl2softwaregraphics.cpp index c72dd5a7f..53efc85ed 100644 --- a/src/render/sdl2softwaregraphics.cpp +++ b/src/render/sdl2softwaregraphics.cpp @@ -804,10 +804,7 @@ bool SDL2SoftwareGraphics::calcWindow(ImageCollection *const vertCol, } const Image *const *const grid = &imgRect.grid[0]; - return calcImageRect(vert, x, y, w, h, - grid[0], grid[2], grid[6], grid[8], - grid[1], grid[5], grid[7], grid[3], - grid[4]); + return calcImageRect(vert, x, y, w, h, imgRect); } int SDL2SoftwareGraphics::SDL_FakeUpperBlit(const SDL_Surface *const src, diff --git a/src/render/sdlgraphics.cpp b/src/render/sdlgraphics.cpp index 83bf989d2..a8e1d84b6 100644 --- a/src/render/sdlgraphics.cpp +++ b/src/render/sdlgraphics.cpp @@ -803,10 +803,7 @@ bool SDLGraphics::calcWindow(ImageCollection *const vertCol, } const Image *const *const grid = &imgRect.grid[0]; - return calcImageRect(vert, x, y, w, h, - grid[0], grid[2], grid[6], grid[8], - grid[1], grid[5], grid[7], grid[3], - grid[4]); + return calcImageRect(vert, x, y, w, h, imgRect); } int SDLGraphics::SDL_FakeUpperBlit(const SDL_Surface *const src, |