diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-06-29 23:14:53 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-06-29 23:39:00 +0300 |
commit | ab7cbe78ea676d5932881152631e6a6eafa530de (patch) | |
tree | 47610db47cbaeb0a8e275f7dc35524b1e87b756c | |
parent | d02762b6dc35e1564e5d1cc7458458f824f251f9 (diff) | |
download | plus-ab7cbe78ea676d5932881152631e6a6eafa530de.tar.gz plus-ab7cbe78ea676d5932881152631e6a6eafa530de.tar.bz2 plus-ab7cbe78ea676d5932881152631e6a6eafa530de.tar.xz plus-ab7cbe78ea676d5932881152631e6a6eafa530de.zip |
Remove useless bool return value from renderers.
-rw-r--r-- | src/render/graphics.cpp | 15 | ||||
-rw-r--r-- | src/render/graphics.h | 12 | ||||
-rw-r--r-- | src/render/graphicsdef.hpp | 10 | ||||
-rw-r--r-- | src/render/imagegraphics.cpp | 9 | ||||
-rw-r--r-- | src/render/imagegraphics.h | 16 | ||||
-rw-r--r-- | src/render/mobileopenglgraphics.cpp | 34 | ||||
-rw-r--r-- | src/render/modernopenglgraphics.cpp | 33 | ||||
-rw-r--r-- | src/render/normalopenglgraphics.cpp | 36 | ||||
-rw-r--r-- | src/render/nullopenglgraphics.cpp | 35 | ||||
-rw-r--r-- | src/render/openglgraphicsdef.hpp | 2 | ||||
-rw-r--r-- | src/render/safeopenglgraphics.cpp | 34 | ||||
-rw-r--r-- | src/render/sdl2graphics.cpp | 32 | ||||
-rw-r--r-- | src/render/sdl2softwaregraphics.cpp | 40 | ||||
-rw-r--r-- | src/render/sdlgraphics.cpp | 41 | ||||
-rw-r--r-- | src/render/surfacegraphics.cpp | 21 | ||||
-rw-r--r-- | src/render/surfacegraphics.h | 16 |
16 files changed, 163 insertions, 223 deletions
diff --git a/src/render/graphics.cpp b/src/render/graphics.cpp index 98dbf0600..a9dc968db 100644 --- a/src/render/graphics.cpp +++ b/src/render/graphics.cpp @@ -543,7 +543,8 @@ int Graphics::getHeight() const return mHeight; } -bool Graphics::drawNet(const int x1, const int y1, const int x2, const int y2, +void Graphics::drawNet(const int x1, const int y1, + const int x2, const int y2, const int width, const int height) { for (int y = y1; y < y2; y += height) @@ -551,8 +552,6 @@ bool Graphics::drawNet(const int x1, const int y1, const int x2, const int y2, for (int x = x1; x < x2; x += width) drawLine(x, y1, x, y2); - - return true; } void Graphics::setWindowSize(const int width A_UNUSED, @@ -563,7 +562,7 @@ void Graphics::setWindowSize(const int width A_UNUSED, #endif } -bool Graphics::pushClipArea(const Rect &area) +void Graphics::pushClipArea(const Rect &area) { // Ignore area with a negate width or height // by simple pushing an empty clip area @@ -572,7 +571,7 @@ bool Graphics::pushClipArea(const Rect &area) { ClipRect carea; mClipStack.push(carea); - return true; + return; } if (mClipStack.empty()) @@ -585,7 +584,7 @@ bool Graphics::pushClipArea(const Rect &area) carea.xOffset = area.x; carea.yOffset = area.y; mClipStack.push(carea); - return true; + return; } const ClipRect &top = mClipStack.top(); @@ -619,11 +618,7 @@ bool Graphics::pushClipArea(const Rect &area) carea.height = 0; } - const bool result = carea.isIntersecting(top); - mClipStack.push(carea); - - return result; } void Graphics::popClipArea() diff --git a/src/render/graphics.h b/src/render/graphics.h index 5e536235f..e05f23a84 100644 --- a/src/render/graphics.h +++ b/src/render/graphics.h @@ -170,7 +170,7 @@ class Graphics notfinal /** * Draws a resclaled version of the image */ - virtual bool drawRescaledImage(const Image *const image, + virtual void drawRescaledImage(const Image *const image, int dstX, int dstY, const int desiredWidth, const int desiredHeight) = 0; @@ -255,7 +255,7 @@ class Graphics notfinal int getMemoryUsage() const A_WARN_UNUSED; - virtual bool drawNet(const int x1, const int y1, + virtual void drawNet(const int x1, const int y1, const int x2, const int y2, const int width, const int height); @@ -344,10 +344,10 @@ class Graphics notfinal * @return <code>true</code> if the image was blitted properly * <code>false</code> otherwise. */ - virtual bool drawImage(const Image *const image, + virtual void drawImage(const Image *const image, int dstX, int dstY) = 0; - virtual bool copyImage(const Image *const image, + virtual void copyImage(const Image *const image, int dstX, int dstY) = 0; virtual void drawImageCached(const Image *const image, @@ -377,10 +377,8 @@ class Graphics notfinal * zero width and height will be pushed. * * @param area The clip area to be pushed onto the stack. - * @return False if the the new area lays outside the current clip - * area. */ - virtual bool pushClipArea(const Rect &area); + virtual void pushClipArea(const Rect &area); /** * Removes the top most clip area from the stack. diff --git a/src/render/graphicsdef.hpp b/src/render/graphicsdef.hpp index 19282584c..b02c7201f 100644 --- a/src/render/graphicsdef.hpp +++ b/src/render/graphicsdef.hpp @@ -33,14 +33,14 @@ public: void endDraw(); - bool pushClipArea(const Rect &area) override final; + void pushClipArea(const Rect &area) override final; void popClipArea() override final; /** * Draws a resclaled version of the image */ - bool drawRescaledImage(const Image *const image, + void drawRescaledImage(const Image *const image, int dstX, int dstY, const int desiredWidth, const int desiredHeight) override final; @@ -111,10 +111,10 @@ public: const bool resize, const bool noFrame) override final; - bool drawImage(const Image *const image, + void drawImage(const Image *const image, int dstX, int dstY) override final; - bool copyImage(const Image *const image, + void copyImage(const Image *const image, int dstX, int dstY) override final; void drawImageCached(const Image *const image, @@ -141,5 +141,5 @@ private: const Image *const image, int x, int y) const; - bool inline drawImageInline(const Image *const image, + void inline drawImageInline(const Image *const image, int dstX, int dstY); diff --git a/src/render/imagegraphics.cpp b/src/render/imagegraphics.cpp index 8f9cd8943..b439fb0e4 100644 --- a/src/render/imagegraphics.cpp +++ b/src/render/imagegraphics.cpp @@ -42,20 +42,17 @@ ImegeGraphics::~ImegeGraphics() { } -bool ImegeGraphics::drawImage(const Image *const image A_UNUSED, +void ImegeGraphics::drawImage(const Image *const image A_UNUSED, int dstX A_UNUSED, int dstY A_UNUSED) { // for now not implimented - return false; } -bool ImegeGraphics::copyImage(const Image *const image, +void ImegeGraphics::copyImage(const Image *const image, int dstX A_UNUSED, int dstY A_UNUSED) { if (!mTarget || !image) - return false; - - return false; + return; } void ImegeGraphics::drawImageCached(const Image *const image, diff --git a/src/render/imagegraphics.h b/src/render/imagegraphics.h index 5d55fb2bb..2f15a9e51 100644 --- a/src/render/imagegraphics.h +++ b/src/render/imagegraphics.h @@ -59,18 +59,18 @@ class ImegeGraphics final : public Graphics void endDraw() override final { } - bool pushClipArea(const Rect &rect A_UNUSED) override final - { return true; } + void pushClipArea(const Rect &rect A_UNUSED) override final + { } void popClipArea() override final { } - bool drawRescaledImage(const Image *const image A_UNUSED, + void drawRescaledImage(const Image *const image A_UNUSED, int dstX A_UNUSED, int dstY A_UNUSED, const int desiredWidth A_UNUSED, const int desiredHeight A_UNUSED) override final - { return false; } + { } void drawPattern(const Image *const image A_UNUSED, const int x A_UNUSED, @@ -134,13 +134,13 @@ class ImegeGraphics final : public Graphics SDL_Surface *getScreenshot() override final A_WARN_UNUSED { return nullptr; } - bool drawNet(const int x1 A_UNUSED, + void drawNet(const int x1 A_UNUSED, const int y1 A_UNUSED, const int x2 A_UNUSED, const int y2 A_UNUSED, const int width A_UNUSED, const int height A_UNUSED) override final - { return false; } + { } void calcWindow(ImageCollection *const vertCol A_UNUSED, const int x A_UNUSED, const int y A_UNUSED, @@ -169,10 +169,10 @@ class ImegeGraphics final : public Graphics const bool noFrame A_UNUSED) override final { return false; } - bool drawImage(const Image *const image, + void drawImage(const Image *const image, int dstX, int dstY) override final; - bool copyImage(const Image *const image, + void copyImage(const Image *const image, int dstX, int dstY) override final; void drawImageCached(const Image *const image, diff --git a/src/render/mobileopenglgraphics.cpp b/src/render/mobileopenglgraphics.cpp index 346fe60ec..555b8d33b 100644 --- a/src/render/mobileopenglgraphics.cpp +++ b/src/render/mobileopenglgraphics.cpp @@ -240,18 +240,18 @@ static inline void drawRescaledQuad(const Image *const image, } } -bool MobileOpenGLGraphics::drawImage(const Image *const image, +void MobileOpenGLGraphics::drawImage(const Image *const image, int dstX, int dstY) { - return drawImageInline(image, dstX, dstY); + drawImageInline(image, dstX, dstY); } -bool MobileOpenGLGraphics::drawImageInline(const Image *const image, +void MobileOpenGLGraphics::drawImageInline(const Image *const image, int dstX, int dstY) { FUNC_BLOCK("Graphics::drawImage", 1) if (!image) - return false; + return; setColorAlpha(image->mAlpha); #ifdef DEBUG_BIND_TEXTURE @@ -263,14 +263,12 @@ bool MobileOpenGLGraphics::drawImageInline(const Image *const image, const SDL_Rect &imageRect = image->mBounds; drawQuad(image, imageRect.x, imageRect.y, dstX, dstY, imageRect.w, imageRect.h); - - return true; } -bool MobileOpenGLGraphics::copyImage(const Image *const image, +void MobileOpenGLGraphics::copyImage(const Image *const image, int dstX, int dstY) { - return drawImageInline(image, dstX, dstY); + drawImageInline(image, dstX, dstY); } void MobileOpenGLGraphics::drawImageCached(const Image *const image, @@ -405,20 +403,23 @@ void MobileOpenGLGraphics::completeCache() mVpCached = 0; } -bool MobileOpenGLGraphics::drawRescaledImage(const Image *const image, +void MobileOpenGLGraphics::drawRescaledImage(const Image *const image, int dstX, int dstY, const int desiredWidth, const int desiredHeight) { FUNC_BLOCK("Graphics::drawRescaledImage", 1) if (!image) - return false; + return; const SDL_Rect &imageRect = image->mBounds; // Just draw the image normally when no resizing is necessary, if (imageRect.w == desiredWidth && imageRect.h == desiredHeight) - return drawImageInline(image, dstX, dstY); + { + drawImageInline(image, dstX, dstY); + return; + } setColorAlpha(image->mAlpha); #ifdef DEBUG_BIND_TEXTURE @@ -430,8 +431,6 @@ bool MobileOpenGLGraphics::drawRescaledImage(const Image *const image, // Draw a textured quad. drawRescaledQuad(image, imageRect.x, imageRect.y, dstX, dstY, imageRect.w, imageRect.h, desiredWidth, desiredHeight); - - return true; } void MobileOpenGLGraphics::drawPattern(const Image *const image, @@ -980,7 +979,7 @@ SDL_Surface* MobileOpenGLGraphics::getScreenshot() return screenshot; } -bool MobileOpenGLGraphics::pushClipArea(const Rect &area) +void MobileOpenGLGraphics::pushClipArea(const Rect &area) { int transX = 0; int transY = 0; @@ -992,7 +991,7 @@ bool MobileOpenGLGraphics::pushClipArea(const Rect &area) transY = -clipArea.yOffset; } - const bool result = Graphics::pushClipArea(area); + Graphics::pushClipArea(area); const ClipRect &clipArea = mClipStack.top(); transX += clipArea.xOffset; @@ -1007,7 +1006,6 @@ bool MobileOpenGLGraphics::pushClipArea(const Rect &area) (mRect.h - clipArea.y - clipArea.height) * mScale, clipArea.width * mScale, clipArea.height * mScale); - return result; } void MobileOpenGLGraphics::popClipArea() @@ -1168,7 +1166,7 @@ void MobileOpenGLGraphics::drawRectangle(const Rect& rect, BLOCK_END("Graphics::drawRectangle") } -bool MobileOpenGLGraphics::drawNet(const int x1, const int y1, +void MobileOpenGLGraphics::drawNet(const int x1, const int y1, const int x2, const int y2, const int width, const int height) { @@ -1219,8 +1217,6 @@ bool MobileOpenGLGraphics::drawNet(const int x1, const int y1, if (vp > 0) drawLineArrays(vp); - - return true; } void MobileOpenGLGraphics::bindTexture(const GLenum target, diff --git a/src/render/modernopenglgraphics.cpp b/src/render/modernopenglgraphics.cpp index faaa206d7..1fadba3c4 100644 --- a/src/render/modernopenglgraphics.cpp +++ b/src/render/modernopenglgraphics.cpp @@ -313,18 +313,18 @@ void ModernOpenGLGraphics::drawRescaledQuad(const Image *const image A_UNUSED, glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); } -bool ModernOpenGLGraphics::drawImage(const Image *const image, +void ModernOpenGLGraphics::drawImage(const Image *const image, int dstX, int dstY) { - return drawImageInline(image, dstX, dstY); + drawImageInline(image, dstX, dstY); } -bool ModernOpenGLGraphics::drawImageInline(const Image *const image, +void ModernOpenGLGraphics::drawImageInline(const Image *const image, int dstX, int dstY) { FUNC_BLOCK("Graphics::drawImage", 1) if (!image) - return false; + return; #ifdef DEBUG_BIND_TEXTURE debugBindTexture(image); @@ -340,13 +340,12 @@ bool ModernOpenGLGraphics::drawImageInline(const Image *const image, imageRect.x, imageRect.y, dstX + clipArea.xOffset, dstY + clipArea.yOffset, imageRect.w, imageRect.h); - return true; } -bool ModernOpenGLGraphics::copyImage(const Image *const image, +void ModernOpenGLGraphics::copyImage(const Image *const image, int dstX, int dstY) { - return drawImageInline(image, dstX, dstY); + drawImageInline(image, dstX, dstY); } void ModernOpenGLGraphics::testDraw() @@ -390,19 +389,22 @@ void ModernOpenGLGraphics::completeCache() { } -bool ModernOpenGLGraphics::drawRescaledImage(const Image *const image, +void ModernOpenGLGraphics::drawRescaledImage(const Image *const image, int dstX, int dstY, const int desiredWidth, const int desiredHeight) { if (!image) - return false; + return; const SDL_Rect &imageRect = image->mBounds; // Just draw the image normally when no resizing is necessary, if (imageRect.w == desiredWidth && imageRect.h == desiredHeight) - return drawImageInline(image, dstX, dstY); + { + drawImageInline(image, dstX, dstY); + return; + } setColorAlpha(image->mAlpha); #ifdef DEBUG_BIND_TEXTURE @@ -419,8 +421,6 @@ bool ModernOpenGLGraphics::drawRescaledImage(const Image *const image, dstX + clipArea.xOffset, dstY + clipArea.yOffset, imageRect.w, imageRect.h, desiredWidth, desiredHeight); - - return true; } void ModernOpenGLGraphics::drawPattern(const Image *const image, @@ -912,16 +912,15 @@ SDL_Surface* ModernOpenGLGraphics::getScreenshot() return screenshot; } -bool ModernOpenGLGraphics::pushClipArea(const Rect &area) +void ModernOpenGLGraphics::pushClipArea(const Rect &area) { - const bool result = Graphics::pushClipArea(area); + Graphics::pushClipArea(area); const ClipRect &clipArea = mClipStack.top(); glScissor(clipArea.x * mScale, (mRect.h - clipArea.y - clipArea.height) * mScale, clipArea.width * mScale, clipArea.height * mScale); - return result; } void ModernOpenGLGraphics::popClipArea() @@ -1068,7 +1067,7 @@ void ModernOpenGLGraphics::drawRectangle(const Rect& rect A_UNUSED, { } -bool ModernOpenGLGraphics::drawNet(const int x1, const int y1, +void ModernOpenGLGraphics::drawNet(const int x1, const int y1, const int x2, const int y2, const int width, const int height) { @@ -1128,8 +1127,6 @@ bool ModernOpenGLGraphics::drawNet(const int x1, const int y1, if (vp > 0) drawLineArrays(vp); - - return true; } void ModernOpenGLGraphics::bindTexture(const GLenum target, diff --git a/src/render/normalopenglgraphics.cpp b/src/render/normalopenglgraphics.cpp index 57f1d58cb..bbe6c8851 100644 --- a/src/render/normalopenglgraphics.cpp +++ b/src/render/normalopenglgraphics.cpp @@ -330,19 +330,18 @@ static inline void drawRescaledQuad(const Image *const image, } } -bool NormalOpenGLGraphics::drawImage(const Image *const image, +void NormalOpenGLGraphics::drawImage(const Image *const image, int dstX, int dstY) { - return drawImageInline(image, dstX, dstY); + drawImageInline(image, dstX, dstY); } -bool NormalOpenGLGraphics::drawImageInline(const Image *const image, +void NormalOpenGLGraphics::drawImageInline(const Image *const image, int dstX, int dstY) { FUNC_BLOCK("Graphics::drawImage", 1) if (!image) - return false; - + return; setColorAlpha(image->mAlpha); #ifdef DEBUG_BIND_TEXTURE @@ -354,14 +353,12 @@ bool NormalOpenGLGraphics::drawImageInline(const Image *const image, const SDL_Rect &imageRect = image->mBounds; drawQuad(image, imageRect.x, imageRect.y, dstX, dstY, imageRect.w, imageRect.h); - - return true; } -bool NormalOpenGLGraphics::copyImage(const Image *const image, +void NormalOpenGLGraphics::copyImage(const Image *const image, int dstX, int dstY) { - return drawImageInline(image, dstX, dstY); + drawImageInline(image, dstX, dstY); } void NormalOpenGLGraphics::testDraw() @@ -594,20 +591,23 @@ void NormalOpenGLGraphics::completeCache() mVpCached = 0; } -bool NormalOpenGLGraphics::drawRescaledImage(const Image *const image, +void NormalOpenGLGraphics::drawRescaledImage(const Image *const image, int dstX, int dstY, const int desiredWidth, const int desiredHeight) { FUNC_BLOCK("Graphics::drawRescaledImage", 1) if (!image) - return false; + return; const SDL_Rect &imageRect = image->mBounds; // Just draw the image normally when no resizing is necessary, if (imageRect.w == desiredWidth && imageRect.h == desiredHeight) - return drawImageInline(image, dstX, dstY); + { + drawImageInline(image, dstX, dstY); + return; + } setColorAlpha(image->mAlpha); #ifdef DEBUG_BIND_TEXTURE @@ -619,8 +619,6 @@ bool NormalOpenGLGraphics::drawRescaledImage(const Image *const image, // Draw a textured quad. drawRescaledQuad(image, imageRect.x, imageRect.y, dstX, dstY, imageRect.w, imageRect.h, desiredWidth, desiredHeight); - - return true; } void NormalOpenGLGraphics::drawPattern(const Image *const image, @@ -1318,7 +1316,7 @@ SDL_Surface* NormalOpenGLGraphics::getScreenshot() return screenshot; } -bool NormalOpenGLGraphics::pushClipArea(const Rect &area) +void NormalOpenGLGraphics::pushClipArea(const Rect &area) { int transX = 0; int transY = 0; @@ -1330,7 +1328,7 @@ bool NormalOpenGLGraphics::pushClipArea(const Rect &area) transY = -clipArea.yOffset; } - const bool result = Graphics::pushClipArea(area); + Graphics::pushClipArea(area); const ClipRect &clipArea = mClipStack.top(); transX += clipArea.xOffset; @@ -1345,8 +1343,6 @@ bool NormalOpenGLGraphics::pushClipArea(const Rect &area) (mRect.h - clipArea.y - clipArea.height) * mScale, clipArea.width * mScale, clipArea.height * mScale); - - return result; } void NormalOpenGLGraphics::popClipArea() @@ -1484,7 +1480,7 @@ void NormalOpenGLGraphics::drawRectangle(const Rect& rect, BLOCK_END("Graphics::drawRectangle") } -bool NormalOpenGLGraphics::drawNet(const int x1, const int y1, +void NormalOpenGLGraphics::drawNet(const int x1, const int y1, const int x2, const int y2, const int width, const int height) { @@ -1533,8 +1529,6 @@ bool NormalOpenGLGraphics::drawNet(const int x1, const int y1, if (vp > 0) drawLineArrayf(vp); - - return true; } void NormalOpenGLGraphics::bindTexture(const GLenum target, diff --git a/src/render/nullopenglgraphics.cpp b/src/render/nullopenglgraphics.cpp index dce5f93ee..2c4d9f211 100644 --- a/src/render/nullopenglgraphics.cpp +++ b/src/render/nullopenglgraphics.cpp @@ -151,24 +151,24 @@ static inline void drawRescaledQuad(const Image *const image A_UNUSED, } } -bool NullOpenGLGraphics::drawImage(const Image *const image, +void NullOpenGLGraphics::drawImage(const Image *const image, int dstX, int dstY) { - return drawImageInline(image, dstX, dstY); + drawImageInline(image, dstX, dstY); } -bool NullOpenGLGraphics::copyImage(const Image *const image, +void NullOpenGLGraphics::copyImage(const Image *const image, int dstX, int dstY) { - return drawImageInline(image, dstX, dstY); + drawImageInline(image, dstX, dstY); } -bool NullOpenGLGraphics::drawImageInline(const Image *const image, +void NullOpenGLGraphics::drawImageInline(const Image *const image, int dstX, int dstY) { FUNC_BLOCK("Graphics::drawImage", 1) if (!image) - return false; + return; setColorAlpha(image->mAlpha); #ifdef DEBUG_BIND_TEXTURE @@ -180,8 +180,6 @@ bool NullOpenGLGraphics::drawImageInline(const Image *const image, const SDL_Rect &imageRect = image->mBounds; drawQuad(image, imageRect.x, imageRect.y, dstX, dstY, imageRect.w, imageRect.h); - - return true; } void NullOpenGLGraphics::drawImageCached(const Image *const image A_UNUSED, @@ -201,20 +199,23 @@ void NullOpenGLGraphics::completeCache() { } -bool NullOpenGLGraphics::drawRescaledImage(const Image *const image, +void NullOpenGLGraphics::drawRescaledImage(const Image *const image, int dstX, int dstY, const int desiredWidth, const int desiredHeight) { FUNC_BLOCK("Graphics::drawRescaledImage", 1) if (!image) - return false; + return; const SDL_Rect &imageRect = image->mBounds; // Just draw the image normally when no resizing is necessary, if (imageRect.w == desiredWidth && imageRect.h == desiredHeight) - return drawImageInline(image, dstX, dstY); + { + drawImageInline(image, dstX, dstY); + return; + } setColorAlpha(image->mAlpha); #ifdef DEBUG_BIND_TEXTURE @@ -226,8 +227,6 @@ bool NullOpenGLGraphics::drawRescaledImage(const Image *const image, // Draw a textured quad. drawRescaledQuad(image, imageRect.x, imageRect.y, dstX, dstY, imageRect.w, imageRect.h, desiredWidth, desiredHeight); - - return true; } void NullOpenGLGraphics::drawPattern(const Image *const image, @@ -953,7 +952,7 @@ SDL_Surface* NullOpenGLGraphics::getScreenshot() return nullptr; } -bool NullOpenGLGraphics::pushClipArea(const Rect &area) +void NullOpenGLGraphics::pushClipArea(const Rect &area) { int transX = 0; int transY = 0; @@ -965,13 +964,11 @@ bool NullOpenGLGraphics::pushClipArea(const Rect &area) transY = -clipArea.yOffset; } - const bool result = Graphics::pushClipArea(area); + Graphics::pushClipArea(area); const ClipRect &clipArea = mClipStack.top(); transX += clipArea.xOffset; transY += clipArea.yOffset; - - return result; } void NullOpenGLGraphics::popClipArea() @@ -1048,7 +1045,7 @@ void NullOpenGLGraphics::drawRectangle(const Rect& rect A_UNUSED, BLOCK_END("Graphics::drawRectangle") } -bool NullOpenGLGraphics::drawNet(const int x1, const int y1, +void NullOpenGLGraphics::drawNet(const int x1, const int y1, const int x2, const int y2, const int width, const int height) { @@ -1097,8 +1094,6 @@ bool NullOpenGLGraphics::drawNet(const int x1, const int y1, if (vp > 0) drawLineArrayf(vp); - - return true; } void NullOpenGLGraphics::bindTexture(const GLenum target A_UNUSED, diff --git a/src/render/openglgraphicsdef.hpp b/src/render/openglgraphicsdef.hpp index 016c2762c..393803789 100644 --- a/src/render/openglgraphicsdef.hpp +++ b/src/render/openglgraphicsdef.hpp @@ -24,7 +24,7 @@ public: void drawRectangle(const Rect &rect, const bool filled); - bool drawNet(const int x1, const int y1, + void drawNet(const int x1, const int y1, const int x2, const int y2, const int width, const int height) override final; diff --git a/src/render/safeopenglgraphics.cpp b/src/render/safeopenglgraphics.cpp index 53b842839..fc202df44 100644 --- a/src/render/safeopenglgraphics.cpp +++ b/src/render/safeopenglgraphics.cpp @@ -149,18 +149,18 @@ static inline void drawRescaledQuad(const Image *const image, } } -bool SafeOpenGLGraphics::drawImage(const Image *const image, +void SafeOpenGLGraphics::drawImage(const Image *const image, int dstX, int dstY) { - return drawImageInline(image, dstX, dstY); + drawImageInline(image, dstX, dstY); } -bool SafeOpenGLGraphics::drawImageInline(const Image *const image, +void SafeOpenGLGraphics::drawImageInline(const Image *const image, int dstX, int dstY) { FUNC_BLOCK("Graphics::drawImage", 1) if (!image) - return false; + return; setColorAlpha(image->mAlpha); bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage); @@ -172,14 +172,12 @@ bool SafeOpenGLGraphics::drawImageInline(const Image *const image, drawQuad(image, bounds.x, bounds.y, dstX, dstY, bounds.w, bounds.h); glEnd(); - - return true; } -bool SafeOpenGLGraphics::copyImage(const Image *const image, +void SafeOpenGLGraphics::copyImage(const Image *const image, int dstX, int dstY) { - return drawImageInline(image, dstX, dstY); + drawImageInline(image, dstX, dstY); } void SafeOpenGLGraphics::testDraw() @@ -273,20 +271,23 @@ void SafeOpenGLGraphics::completeCache() { } -bool SafeOpenGLGraphics::drawRescaledImage(const Image *const image, +void SafeOpenGLGraphics::drawRescaledImage(const Image *const image, int dstX, int dstY, const int desiredWidth, const int desiredHeight) { FUNC_BLOCK("Graphics::drawRescaledImage", 1) if (!image) - return false; + return; const SDL_Rect &imageRect = image->mBounds; // Just draw the image normally when no resizing is necessary, if (imageRect.w == desiredWidth && imageRect.h == desiredHeight) - return drawImageInline(image, dstX, dstY); + { + drawImageInline(image, dstX, dstY); + return; + } setColorAlpha(image->mAlpha); bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage); @@ -297,8 +298,6 @@ bool SafeOpenGLGraphics::drawRescaledImage(const Image *const image, drawRescaledQuad(image, imageRect.x, imageRect.y, dstX, dstY, imageRect.w, imageRect.h, desiredWidth, desiredHeight); glEnd(); - - return true; } void SafeOpenGLGraphics::drawPattern(const Image *const image, @@ -570,7 +569,7 @@ SDL_Surface* SafeOpenGLGraphics::getScreenshot() return screenshot; } -bool SafeOpenGLGraphics::pushClipArea(const Rect &area) +void SafeOpenGLGraphics::pushClipArea(const Rect &area) { int transX = 0; int transY = 0; @@ -582,7 +581,7 @@ bool SafeOpenGLGraphics::pushClipArea(const Rect &area) transY = -clipArea.yOffset; } - const bool result = Graphics::pushClipArea(area); + Graphics::pushClipArea(area); const ClipRect &clipArea = mClipStack.top(); @@ -593,7 +592,6 @@ bool SafeOpenGLGraphics::pushClipArea(const Rect &area) (mRect.h - clipArea.y - clipArea.height) * mScale, clipArea.width * mScale, clipArea.height * mScale); - return result; } void SafeOpenGLGraphics::popClipArea() @@ -621,7 +619,7 @@ void SafeOpenGLGraphics::drawPoint(int x, int y) glEnd(); } -bool SafeOpenGLGraphics::drawNet(const int x1, const int y1, +void SafeOpenGLGraphics::drawNet(const int x1, const int y1, const int x2, const int y2, const int width, const int height) { @@ -645,8 +643,6 @@ bool SafeOpenGLGraphics::drawNet(const int x1, const int y1, static_cast<float>(y2) + 0.5F); } glEnd(); - - return true; } void SafeOpenGLGraphics::drawLine(int x1, int y1, int x2, int y2) diff --git a/src/render/sdl2graphics.cpp b/src/render/sdl2graphics.cpp index fc9c8222d..b585d8467 100644 --- a/src/render/sdl2graphics.cpp +++ b/src/render/sdl2graphics.cpp @@ -141,17 +141,15 @@ SDLGraphics::~SDLGraphics() { } -bool SDLGraphics::drawRescaledImage(const Image *const image, +void SDLGraphics::drawRescaledImage(const Image *const image, int dstX, int dstY, const int desiredWidth, const int desiredHeight) { FUNC_BLOCK("Graphics::drawRescaledImage", 1) // Check that preconditions for blitting are met. - if (!mWindow || !image) - return false; - if (!image->mTexture) - return false; + if (!mWindow || !image || !image->mTexture) + return; const ClipRect &top = mClipStack.top(); const SDL_Rect &bounds = image->mBounds; @@ -170,27 +168,26 @@ bool SDLGraphics::drawRescaledImage(const Image *const image, static_cast<int32_t>(desiredHeight) }; - return (MSDL_RenderCopy(mRenderer, image->mTexture, - &srcRect, &dstRect) < 0); + MSDL_RenderCopy(mRenderer, image->mTexture, &srcRect, &dstRect); } -bool SDLGraphics::drawImage(const Image *const image, +void SDLGraphics::drawImage(const Image *const image, int dstX, int dstY) { - return drawImageInline(image, dstX, dstY); + drawImageInline(image, dstX, dstY); } -bool SDLGraphics::drawImageInline(const Image *const image, +void SDLGraphics::drawImageInline(const Image *const image, int dstX, int dstY) { FUNC_BLOCK("Graphics::drawImage", 1) // Check that preconditions for blitting are met. if (!mWindow || !image || !image->mTexture) - return false; + return; const ClipRect &top = mClipStack.top(); if (!top.width || !top.height) - return false; + return; const SDL_Rect &bounds = image->mBounds; const SDL_Rect srcRect = @@ -209,13 +206,13 @@ bool SDLGraphics::drawImageInline(const Image *const image, static_cast<int32_t>(bounds.h) }; - return !MSDL_RenderCopy(mRenderer, image->mTexture, &srcRect, &dstRect); + MSDL_RenderCopy(mRenderer, image->mTexture, &srcRect, &dstRect); } -bool SDLGraphics::copyImage(const Image *const image, +void SDLGraphics::copyImage(const Image *const image, int dstX, int dstY) { - return drawImageInline(image, dstX, dstY); + drawImageInline(image, dstX, dstY); } void SDLGraphics::drawImageCached(const Image *const image, @@ -672,14 +669,13 @@ void SDLGraphics::endDraw() popClipArea(); } -bool SDLGraphics::pushClipArea(const Rect &area) +void SDLGraphics::pushClipArea(const Rect &area) { - const bool result = Graphics::pushClipArea(area); + Graphics::pushClipArea(area); const ClipRect &carea = mClipStack.top(); defRectFromArea(rect, carea); SDL_RenderSetClipRect(mRenderer, &rect); - return result; } void SDLGraphics::popClipArea() diff --git a/src/render/sdl2softwaregraphics.cpp b/src/render/sdl2softwaregraphics.cpp index 65053696d..936c5a249 100644 --- a/src/render/sdl2softwaregraphics.cpp +++ b/src/render/sdl2softwaregraphics.cpp @@ -72,25 +72,21 @@ SDL2SoftwareGraphics::~SDL2SoftwareGraphics() { } -bool SDL2SoftwareGraphics::drawRescaledImage(const Image *const image, +void SDL2SoftwareGraphics::drawRescaledImage(const Image *const image, int dstX, int dstY, const int desiredWidth, const int desiredHeight) { FUNC_BLOCK("Graphics::drawRescaledImage", 1) // Check that preconditions for blitting are met. - if (!mSurface || !image) - return false; - if (!image->mSDLSurface) - return false; + if (!mSurface || !image || !image->mSDLSurface) + return; Image *const tmpImage = image->SDLgetScaledImage( desiredWidth, desiredHeight); - if (!tmpImage) - return false; - if (!tmpImage->mSDLSurface) - return false; + if (!tmpImage || !tmpImage->mSDLSurface) + return; const ClipRect &top = mClipStack.top(); const SDL_Rect &bounds = image->mBounds; @@ -111,27 +107,23 @@ bool SDL2SoftwareGraphics::drawRescaledImage(const Image *const image, 0 }; - const bool returnValue = !(SDL_BlitSurface(tmpImage->mSDLSurface, - &srcRect, mSurface, &dstRect) < 0); - + SDL_BlitSurface(tmpImage->mSDLSurface, &srcRect, mSurface, &dstRect); delete tmpImage; - - return returnValue; } -bool SDL2SoftwareGraphics::drawImage(const Image *const image, +void SDL2SoftwareGraphics::drawImage(const Image *const image, int dstX, int dstY) { - return drawImageInline(image, dstX, dstY); + drawImageInline(image, dstX, dstY); } -bool SDL2SoftwareGraphics::drawImageInline(const Image *const image, +void SDL2SoftwareGraphics::drawImageInline(const Image *const image, int dstX, int dstY) { FUNC_BLOCK("Graphics::drawImage", 1) // Check that preconditions for blitting are met. if (!mSurface || !image || !image->mSDLSurface) - return false; + return; const ClipRect &top = mClipStack.top(); const SDL_Rect &bounds = image->mBounds; @@ -208,15 +200,14 @@ bool SDL2SoftwareGraphics::drawImageInline(const Image *const image, static_cast<uint16_t>(h) }; - return SDL_LowerBlit(src, &srcRect, mSurface, &dstRect); + SDL_LowerBlit(src, &srcRect, mSurface, &dstRect); } - return 0; } -bool SDL2SoftwareGraphics::copyImage(const Image *const image, +void SDL2SoftwareGraphics::copyImage(const Image *const image, int dstX, int dstY) { - return drawImageInline(image, dstX, dstY); + drawImageInline(image, dstX, dstY); } void SDL2SoftwareGraphics::drawImageCached(const Image *const image, @@ -1120,14 +1111,13 @@ void SDL2SoftwareGraphics::endDraw() popClipArea(); } -bool SDL2SoftwareGraphics::pushClipArea(const Rect &area) +void SDL2SoftwareGraphics::pushClipArea(const Rect &area) { - const bool result = Graphics::pushClipArea(area); + Graphics::pushClipArea(area); const ClipRect &carea = mClipStack.top(); defRectFromArea(rect, carea); SDL_SetClipRect(mSurface, &rect); - return result; } void SDL2SoftwareGraphics::popClipArea() diff --git a/src/render/sdlgraphics.cpp b/src/render/sdlgraphics.cpp index e9b6bef4a..a54087864 100644 --- a/src/render/sdlgraphics.cpp +++ b/src/render/sdlgraphics.cpp @@ -57,25 +57,21 @@ SDLGraphics::~SDLGraphics() { } -bool SDLGraphics::drawRescaledImage(const Image *const image, +void SDLGraphics::drawRescaledImage(const Image *const image, int dstX, int dstY, const int desiredWidth, const int desiredHeight) { FUNC_BLOCK("Graphics::drawRescaledImage", 1) // Check that preconditions for blitting are met. - if (!mWindow || !image) - return false; - if (!image->mSDLSurface) - return false; + if (!mWindow || !image || !image->mSDLSurface) + return; Image *const tmpImage = image->SDLgetScaledImage( desiredWidth, desiredHeight); - if (!tmpImage) - return false; - if (!tmpImage->mSDLSurface) - return false; + if (!tmpImage || !tmpImage->mSDLSurface) + return; const ClipRect &top = mClipStack.top(); const SDL_Rect &bounds = image->mBounds; @@ -96,27 +92,23 @@ bool SDLGraphics::drawRescaledImage(const Image *const image, 0 }; - const bool returnValue = !(SDL_BlitSurface(tmpImage->mSDLSurface, - &srcRect, mWindow, &dstRect) < 0); - + SDL_BlitSurface(tmpImage->mSDLSurface, &srcRect, mWindow, &dstRect); delete tmpImage; - - return returnValue; } -bool SDLGraphics::drawImage(const Image *const image, +void SDLGraphics::drawImage(const Image *const image, int dstX, int dstY) { - return drawImageInline(image, dstX, dstY); + drawImageInline(image, dstX, dstY); } -bool SDLGraphics::drawImageInline(const Image *const image, +void SDLGraphics::drawImageInline(const Image *const image, int dstX, int dstY) { FUNC_BLOCK("Graphics::drawImage", 1) // Check that preconditions for blitting are met. if (!mWindow || !image || !image->mSDLSurface) - return false; + return; const ClipRect &top = mClipStack.top(); const SDL_Rect &bounds = image->mBounds; @@ -193,15 +185,14 @@ bool SDLGraphics::drawImageInline(const Image *const image, static_cast<uint16_t>(h) }; - return SDL_LowerBlit(src, &srcRect, mWindow, &dstRect); + SDL_LowerBlit(src, &srcRect, mWindow, &dstRect); } - return 0; } -bool SDLGraphics::copyImage(const Image *const image, +void SDLGraphics::copyImage(const Image *const image, int dstX, int dstY) { - return drawImageInline(image, dstX, dstY); + drawImageInline(image, dstX, dstY); } void SDLGraphics::drawImageCached(const Image *const image, @@ -1119,9 +1110,9 @@ void SDLGraphics::endDraw() popClipArea(); } -bool SDLGraphics::pushClipArea(const Rect &area) +void SDLGraphics::pushClipArea(const Rect &area) { - const bool result = Graphics::pushClipArea(area); + Graphics::pushClipArea(area); const ClipRect &carea = mClipStack.top(); const SDL_Rect rect = { @@ -1131,8 +1122,6 @@ bool SDLGraphics::pushClipArea(const Rect &area) static_cast<uint16_t>(carea.height) }; SDL_SetClipRect(mWindow, &rect); - - return result; } void SDLGraphics::popClipArea() diff --git a/src/render/surfacegraphics.cpp b/src/render/surfacegraphics.cpp index 8691274dd..f3e68ed25 100644 --- a/src/render/surfacegraphics.cpp +++ b/src/render/surfacegraphics.cpp @@ -42,13 +42,13 @@ SurfaceGraphics::~SurfaceGraphics() { } -bool SurfaceGraphics::drawImage(const Image *const image, +void SurfaceGraphics::drawImage(const Image *const image, int dstX, int dstY) { FUNC_BLOCK("Graphics::drawImage", 1) // Check that preconditions for blitting are met. if (!mTarget || !image || !image->mSDLSurface) - return false; + return; const SDL_Rect &imageRect = image->mBounds; SDL_Rect dstRect; @@ -66,24 +66,23 @@ bool SurfaceGraphics::drawImage(const Image *const image, #else if (mBlitMode == BLIT_NORMAL) { - return !(SDL_BlitSurface(image->mSDLSurface, &srcRect, - mTarget, &dstRect) < 0); + SDL_BlitSurface(image->mSDLSurface, &srcRect, mTarget, &dstRect); } else { - return !(SurfaceImageHelper::combineSurface( - image->mSDLSurface, &srcRect, mTarget, &dstRect) < 0); + SurfaceImageHelper::combineSurface(image->mSDLSurface, + &srcRect, mTarget, &dstRect); } #endif } -bool SurfaceGraphics::copyImage(const Image *const image, +void SurfaceGraphics::copyImage(const Image *const image, int dstX, int dstY) { FUNC_BLOCK("Graphics::drawImage", 1) // Check that preconditions for blitting are met. if (!mTarget || !image || !image->mSDLSurface) - return false; + return; const SDL_Rect &imageRect = image->mBounds; SDL_Rect dstRect; @@ -97,11 +96,9 @@ bool SurfaceGraphics::copyImage(const Image *const image, #ifdef USE_SDL2 // probably need change some flags - return !(SDL_BlitSurface(image->mSDLSurface, &srcRect, - mTarget, &dstRect) < 0); + SDL_BlitSurface(image->mSDLSurface, &srcRect, mTarget, &dstRect); #else - return !(SDL_BlitSurface(image->mSDLSurface, &srcRect, - mTarget, &dstRect) < 0); + SDL_BlitSurface(image->mSDLSurface, &srcRect, mTarget, &dstRect); #endif } diff --git a/src/render/surfacegraphics.h b/src/render/surfacegraphics.h index 7150b6ede..72833bd55 100644 --- a/src/render/surfacegraphics.h +++ b/src/render/surfacegraphics.h @@ -63,18 +63,18 @@ class SurfaceGraphics final : public Graphics void endDraw() override final { } - bool pushClipArea(const Rect &rect A_UNUSED) override final - { return true; } + void pushClipArea(const Rect &rect A_UNUSED) override final + { } void popClipArea() override final { } - bool drawRescaledImage(const Image *const image A_UNUSED, + void drawRescaledImage(const Image *const image A_UNUSED, int dstX A_UNUSED, int dstY A_UNUSED, const int desiredWidth A_UNUSED, const int desiredHeight A_UNUSED) override final - { return false; } + { } void drawPattern(const Image *const image A_UNUSED, const int x A_UNUSED, @@ -138,13 +138,13 @@ class SurfaceGraphics final : public Graphics SDL_Surface *getScreenshot() override final A_WARN_UNUSED { return nullptr; } - bool drawNet(const int x1 A_UNUSED, + void drawNet(const int x1 A_UNUSED, const int y1 A_UNUSED, const int x2 A_UNUSED, const int y2 A_UNUSED, const int width A_UNUSED, const int height A_UNUSED) override final - { return false; } + { } void calcWindow(ImageCollection *const vertCol A_UNUSED, const int x A_UNUSED, const int y A_UNUSED, @@ -179,10 +179,10 @@ class SurfaceGraphics final : public Graphics const bool noFrame A_UNUSED) override final { return false; } - bool drawImage(const Image *const image, + void drawImage(const Image *const image, int dstX, int dstY) override final; - bool copyImage(const Image *const image, + void copyImage(const Image *const image, int dstX, int dstY) override final; void drawImageCached(const Image *const image, |