From e29a87a240fe2f33c51f4e15067122960f667d66 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 30 Dec 2013 18:45:00 +0300 Subject: add drawPatternInline into renders for internal usage. --- src/render/mobileopenglgraphics.cpp | 7 +++++++ src/render/normalopenglgraphics.cpp | 7 +++++++ src/render/nullopenglgraphics.cpp | 7 +++++++ src/render/openglgraphics_drawImageRect.hpp | 10 +++++----- src/render/openglgraphicsdef.hpp | 4 ++++ src/render/safeopenglgraphics.cpp | 9 +++++++-- src/render/sdl2graphics.cpp | 7 +++++++ src/render/sdl2graphics.h | 4 ++++ src/render/sdl2softwaregraphics.cpp | 7 +++++++ src/render/sdl2softwaregraphics.h | 4 ++++ src/render/sdlgraphics.cpp | 7 +++++++ src/render/sdlgraphics.h | 4 ++++ 12 files changed, 70 insertions(+), 7 deletions(-) (limited to 'src/render') diff --git a/src/render/mobileopenglgraphics.cpp b/src/render/mobileopenglgraphics.cpp index 33adf6e92..d716582ef 100644 --- a/src/render/mobileopenglgraphics.cpp +++ b/src/render/mobileopenglgraphics.cpp @@ -402,6 +402,13 @@ bool MobileOpenGLGraphics::drawRescaledImage(const Image *const image, void MobileOpenGLGraphics::drawPattern(const Image *const image, const int x, const int y, const int w, const int h) +{ + drawPatternInline(image, x, y, w, h); +} + +void MobileOpenGLGraphics::drawPatternInline(const Image *const image, + const int x, const int y, + const int w, const int h) { FUNC_BLOCK("Graphics::drawPattern", 1) if (!image) diff --git a/src/render/normalopenglgraphics.cpp b/src/render/normalopenglgraphics.cpp index 2088214c0..6626564eb 100644 --- a/src/render/normalopenglgraphics.cpp +++ b/src/render/normalopenglgraphics.cpp @@ -516,6 +516,13 @@ bool NormalOpenGLGraphics::drawRescaledImage(const Image *const image, void NormalOpenGLGraphics::drawPattern(const Image *const image, const int x, const int y, const int w, const int h) +{ + drawPatternInline(image, x, y, w, h); +} + +void NormalOpenGLGraphics::drawPatternInline(const Image *const image, + const int x, const int y, + const int w, const int h) { FUNC_BLOCK("Graphics::drawPattern", 1) if (!image) diff --git a/src/render/nullopenglgraphics.cpp b/src/render/nullopenglgraphics.cpp index aa5a5861b..3883d7134 100644 --- a/src/render/nullopenglgraphics.cpp +++ b/src/render/nullopenglgraphics.cpp @@ -207,6 +207,13 @@ bool NullOpenGLGraphics::drawRescaledImage(const Image *const image, void NullOpenGLGraphics::drawPattern(const Image *const image, const int x, const int y, const int w, const int h) +{ + drawPatternInline(image, x, y, w, h); +} + +void NullOpenGLGraphics::drawPatternInline(const Image *const image, + const int x, const int y, + const int w, const int h) { FUNC_BLOCK("Graphics::drawPattern", 1) if (!image) diff --git a/src/render/openglgraphics_drawImageRect.hpp b/src/render/openglgraphics_drawImageRect.hpp index 734bc8b83..5c4bba0a1 100644 --- a/src/render/openglgraphics_drawImageRect.hpp +++ b/src/render/openglgraphics_drawImageRect.hpp @@ -46,7 +46,7 @@ if (center && drawMain) { const int tlw = topLeft->getWidth(); const int tlh = topLeft->getHeight(); - drawPattern(center, tlw + x, tlh + y, + drawPatternInline(center, tlw + x, tlh + y, w - tlw - topRight->getWidth(), h - tlh - bottomLeft->getHeight()); } @@ -58,11 +58,11 @@ if (top && left && bottom && right) const int rw = right->getWidth(); const int th = top->getHeight(); const int bh = bottom->getHeight(); - drawPattern(top, x + lw, y, w - lw - rw, th); - drawPattern(bottom, x + lw, h - bh + y, w - lw - rw, bh); - drawPattern(left, x, y + th, lw, h - th - bh); + drawPatternInline(top, x + lw, y, w - lw - rw, th); + drawPatternInline(bottom, x + lw, h - bh + y, w - lw - rw, bh); + drawPatternInline(left, x, y + th, lw, h - th - bh); if (w > rw) - drawPattern(right, x + w - rw, th + y, rw, h - th - bh); + drawPatternInline(right, x + w - rw, th + y, rw, h - th - bh); } // Draw the corners if (drawMain) diff --git a/src/render/openglgraphicsdef.hpp b/src/render/openglgraphicsdef.hpp index 70789f023..f935f9062 100644 --- a/src/render/openglgraphicsdef.hpp +++ b/src/render/openglgraphicsdef.hpp @@ -36,6 +36,10 @@ const int desiredWidth, const int desiredHeight) override final; + void inline drawPatternInline(const Image *const image, + const int x, const int y, + const int w, const int h); + void drawPattern(const Image *const image, const int x, const int y, const int w, const int h) override final; diff --git a/src/render/safeopenglgraphics.cpp b/src/render/safeopenglgraphics.cpp index b2e7cd3c0..41d9b7f77 100644 --- a/src/render/safeopenglgraphics.cpp +++ b/src/render/safeopenglgraphics.cpp @@ -249,11 +249,16 @@ bool SafeOpenGLGraphics::drawRescaledImage(const Image *const image, return true; } -/* Optimising the functions that Graphics::drawPattern would call, - * so that glBegin...glEnd are outside the main loop. */ void SafeOpenGLGraphics::drawPattern(const Image *const image, const int x, const int y, const int w, const int h) +{ + drawPatternInline(image, x, y, w, h); +} + +void SafeOpenGLGraphics::drawPatternInline(const Image *const image, + const int x, const int y, + const int w, const int h) { FUNC_BLOCK("Graphics::drawPattern", 1) if (!image) diff --git a/src/render/sdl2graphics.cpp b/src/render/sdl2graphics.cpp index dbfe7ed1e..a91548416 100644 --- a/src/render/sdl2graphics.cpp +++ b/src/render/sdl2graphics.cpp @@ -231,6 +231,13 @@ void SDLGraphics::completeCache() void SDLGraphics::drawPattern(const Image *const image, const int x, const int y, const int w, const int h) +{ + drawParrernInline(image, x, y, w, h); +} + +void SDLGraphics::drawPatternInline(const Image *const image, + const int x, const int y, + const int w, const int h) { FUNC_BLOCK("Graphics::drawPattern", 1) // Check that preconditions for blitting are met. diff --git a/src/render/sdl2graphics.h b/src/render/sdl2graphics.h index 91e789640..25a3a74b3 100644 --- a/src/render/sdl2graphics.h +++ b/src/render/sdl2graphics.h @@ -71,6 +71,10 @@ class SDLGraphics final : public Graphics const int x, const int y, const int w, const int h) override final; + void inline drawPatternInline(const Image *const image, + const int x, const int y, + const int w, const int h); + void drawRescaledPattern(const Image *const image, const int x, const int y, const int w, const int h, diff --git a/src/render/sdl2softwaregraphics.cpp b/src/render/sdl2softwaregraphics.cpp index fbd6e670b..cbcc5f1cb 100644 --- a/src/render/sdl2softwaregraphics.cpp +++ b/src/render/sdl2softwaregraphics.cpp @@ -400,6 +400,13 @@ void SDL2SoftwareGraphics::completeCache() void SDL2SoftwareGraphics::drawPattern(const Image *const image, const int x, const int y, const int w, const int h) +{ + drawPatternInline(image, x, y, w, h); +} + +void SDL2SoftwareGraphics::drawPatternInline(const Image *const image, + const int x, const int y, + const int w, const int h) { FUNC_BLOCK("Graphics::drawPattern", 1) // Check that preconditions for blitting are met. diff --git a/src/render/sdl2softwaregraphics.h b/src/render/sdl2softwaregraphics.h index 441167d01..f6f92a065 100644 --- a/src/render/sdl2softwaregraphics.h +++ b/src/render/sdl2softwaregraphics.h @@ -71,6 +71,10 @@ class SDL2SoftwareGraphics final : public Graphics const int x, const int y, const int w, const int h) override final; + void inline drawPatternInline(const Image *const image, + const int x, const int y, + const int w, const int h); + void drawRescaledPattern(const Image *const image, const int x, const int y, const int w, const int h, diff --git a/src/render/sdlgraphics.cpp b/src/render/sdlgraphics.cpp index 2860f871c..2f13f53f0 100644 --- a/src/render/sdlgraphics.cpp +++ b/src/render/sdlgraphics.cpp @@ -393,6 +393,13 @@ void SDLGraphics::completeCache() void SDLGraphics::drawPattern(const Image *const image, const int x, const int y, const int w, const int h) +{ + drawPatternInline(image, x, y, w, h); +} + +void SDLGraphics::drawPatternInline(const Image *const image, + const int x, const int y, + const int w, const int h) { FUNC_BLOCK("Graphics::drawPattern", 1) // Check that preconditions for blitting are met. diff --git a/src/render/sdlgraphics.h b/src/render/sdlgraphics.h index 1b447c4a4..6fb1fd337 100644 --- a/src/render/sdlgraphics.h +++ b/src/render/sdlgraphics.h @@ -71,6 +71,10 @@ class SDLGraphics final : public Graphics const int x, const int y, const int w, const int h) override final; + void inline drawPatternInline(const Image *const image, + const int x, const int y, + const int w, const int h); + void drawRescaledPattern(const Image *const image, const int x, const int y, const int w, const int h, -- cgit v1.2.3-70-g09d2