diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-05-06 01:17:00 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-05-06 01:17:00 +0300 |
commit | bcd99fe009fb7d8b14ca4a711befa7f156b29ae7 (patch) | |
tree | b9136debb29ae3fe3dbdcb595a5d65092e0bf613 /src | |
parent | 6d8828b47e291c0e85645adb60c8969a3f8facf4 (diff) | |
download | mv-bcd99fe009fb7d8b14ca4a711befa7f156b29ae7.tar.gz mv-bcd99fe009fb7d8b14ca4a711befa7f156b29ae7.tar.bz2 mv-bcd99fe009fb7d8b14ca4a711befa7f156b29ae7.tar.xz mv-bcd99fe009fb7d8b14ca4a711befa7f156b29ae7.zip |
Add const to images in drawing functions.
Diffstat (limited to 'src')
-rw-r--r-- | src/graphics.cpp | 8 | ||||
-rw-r--r-- | src/graphics.h | 11 | ||||
-rw-r--r-- | src/guichan/graphics.cpp | 1 | ||||
-rw-r--r-- | src/opengl1graphics.cpp | 6 | ||||
-rw-r--r-- | src/opengl1graphics.h | 4 | ||||
-rw-r--r-- | src/openglgraphics.cpp | 10 | ||||
-rw-r--r-- | src/openglgraphics.h | 6 |
7 files changed, 25 insertions, 21 deletions
diff --git a/src/graphics.cpp b/src/graphics.cpp index f72e495c6..193d3b271 100644 --- a/src/graphics.cpp +++ b/src/graphics.cpp @@ -351,7 +351,7 @@ int Graphics::getHeight() const return mHeight; } -bool Graphics::drawImage(Image *image, int x, int y) +bool Graphics::drawImage(const Image *image, int x, int y) { if (image) { @@ -408,7 +408,7 @@ bool Graphics::drawRescaledImage(Image *image, int srcX, int srcY, return returnValue; } -bool Graphics::drawImage(Image *image, int srcX, int srcY, int dstX, int dstY, +bool Graphics::drawImage(const Image *image, int srcX, int srcY, int dstX, int dstY, int width, int height, bool) { // Check that preconditions for blitting are met. @@ -442,7 +442,7 @@ bool Graphics::drawImage(Image *image, int srcX, int srcY, int dstX, int dstY, } } -void Graphics::drawImagePattern(Image *image, int x, int y, int w, int h) +void Graphics::drawImagePattern(const Image *image, int x, int y, int w, int h) { // Check that preconditions for blitting are met. if (!mTarget || !image) @@ -639,7 +639,7 @@ void Graphics::drawImageRect2(GraphicsVertexes* vert, const ImageRect &imgRect) } } -void Graphics::drawImagePattern2(GraphicsVertexes *vert, Image *img) +void Graphics::drawImagePattern2(GraphicsVertexes *vert, const Image *img) { // here not checking input parameters diff --git a/src/graphics.h b/src/graphics.h index 805b3a02f..5c3111e0a 100644 --- a/src/graphics.h +++ b/src/graphics.h @@ -115,7 +115,7 @@ class Graphics : public gcn::SDLGraphics * @return <code>true</code> if the image was blitted properly * <code>false</code> otherwise. */ - bool drawImage(Image *image, int x, int y); + bool drawImage(const Image *image, int x, int y); /** * Draws a resclaled version of the image @@ -147,13 +147,13 @@ class Graphics : public gcn::SDLGraphics * @return <code>true</code> if the image was blitted properly * <code>false</code> otherwise. */ - virtual bool drawImage(Image *image, + virtual bool drawImage(const Image *image, int srcX, int srcY, int dstX, int dstY, int width, int height, - bool useColor = false); + bool useColor); - virtual void drawImagePattern(Image *image, + virtual void drawImagePattern(const Image *image, int x, int y, int w, int h); @@ -202,7 +202,8 @@ class Graphics : public gcn::SDLGraphics virtual void drawImageRect2(GraphicsVertexes* vert, const ImageRect &imgRect); - virtual void drawImagePattern2(GraphicsVertexes *vert, Image *img); + virtual void drawImagePattern2(GraphicsVertexes *vert, + const Image *img); bool calcWindow(GraphicsVertexes* vert, int x, int y, int w, int h, diff --git a/src/guichan/graphics.cpp b/src/guichan/graphics.cpp index 1c99d899e..1f6cb8a64 100644 --- a/src/guichan/graphics.cpp +++ b/src/guichan/graphics.cpp @@ -145,6 +145,7 @@ namespace gcn void Graphics::drawImage(const Image* image A_UNUSED, int dstX A_UNUSED, int dstY A_UNUSED) { + throw GCN_EXCEPTION("Not implimented."); } void Graphics::setFont(Font* font) diff --git a/src/opengl1graphics.cpp b/src/opengl1graphics.cpp index 33eabc236..dd39adb8b 100644 --- a/src/opengl1graphics.cpp +++ b/src/opengl1graphics.cpp @@ -71,7 +71,7 @@ bool OpenGL1Graphics::setVideoMode(int w, int h, int bpp, bool fs, return setOpenGLMode(); } -static inline void drawQuad(Image *image, +static inline void drawQuad(const Image *image, int srcX, int srcY, int dstX, int dstY, int width, int height) { @@ -148,7 +148,7 @@ static inline void drawRescaledQuad(Image *image, int srcX, int srcY, } -bool OpenGL1Graphics::drawImage(Image *image, int srcX, int srcY, +bool OpenGL1Graphics::drawImage(const Image *image, int srcX, int srcY, int dstX, int dstY, int width, int height, bool useColor) { @@ -259,7 +259,7 @@ bool OpenGL1Graphics::drawRescaledImage(Image *image, int srcX, int srcY, /* Optimising the functions that Graphics::drawImagePattern would call, * so that glBegin...glEnd are outside the main loop. */ -void OpenGL1Graphics::drawImagePattern(Image *image, int x, int y, +void OpenGL1Graphics::drawImagePattern(const Image *image, int x, int y, int w, int h) { if (!image) diff --git a/src/opengl1graphics.h b/src/opengl1graphics.h index 5a2d6c254..113b4b8a7 100644 --- a/src/opengl1graphics.h +++ b/src/opengl1graphics.h @@ -53,7 +53,7 @@ class OpenGL1Graphics : public Graphics bool setVideoMode(int w, int h, int bpp, bool fs, bool hwaccel, bool resize, bool noFrame); - bool drawImage(Image *image, + bool drawImage(const Image *image, int srcX, int srcY, int dstX, int dstY, int width, int height, @@ -77,7 +77,7 @@ class OpenGL1Graphics : public Graphics int desiredWidth, int desiredHeight, bool useColor, bool smooth); - void drawImagePattern(Image *image, + void drawImagePattern(const Image *image, int x, int y, int w, int h); diff --git a/src/openglgraphics.cpp b/src/openglgraphics.cpp index bf7967254..02e14b77e 100644 --- a/src/openglgraphics.cpp +++ b/src/openglgraphics.cpp @@ -81,7 +81,7 @@ bool OpenGLGraphics::setVideoMode(int w, int h, int bpp, bool fs, return setOpenGLMode(); } -static inline void drawQuad(Image *image, +static inline void drawQuad(const Image *image, int srcX, int srcY, int dstX, int dstY, int width, int height) { @@ -205,7 +205,7 @@ static inline void drawRescaledQuad(Image *image, } -bool OpenGLGraphics::drawImage(Image *image, int srcX, int srcY, +bool OpenGLGraphics::drawImage(const Image *image, int srcX, int srcY, int dstX, int dstY, int width, int height, bool useColor) { @@ -308,7 +308,8 @@ bool OpenGLGraphics::drawRescaledImage(Image *image, int srcX, int srcY, return true; } -void OpenGLGraphics::drawImagePattern(Image *image, int x, int y, int w, int h) +void OpenGLGraphics::drawImagePattern(const Image *image, int x, int y, + int w, int h) { if (!image) return; @@ -592,7 +593,8 @@ void OpenGLGraphics::drawRescaledImagePattern(Image *image, static_cast<GLubyte>(mColor.a)); } -void OpenGLGraphics::drawImagePattern2(GraphicsVertexes *vert, Image *image) +void OpenGLGraphics::drawImagePattern2(GraphicsVertexes *vert, + const Image *image) { if (!image) return; diff --git a/src/openglgraphics.h b/src/openglgraphics.h index 944b8c917..8d90ec72a 100644 --- a/src/openglgraphics.h +++ b/src/openglgraphics.h @@ -55,7 +55,7 @@ class OpenGLGraphics : public Graphics bool setVideoMode(int w, int h, int bpp, bool fs, bool hwaccel, bool resize, bool noFrame); - bool drawImage(Image *image, + bool drawImage(const Image *image, int srcX, int srcY, int dstX, int dstY, int width, int height, @@ -79,7 +79,7 @@ class OpenGLGraphics : public Graphics int desiredWidth, int desiredHeight, bool useColor, bool smooth); - void drawImagePattern(Image *image, + void drawImagePattern(const Image *image, int x, int y, int w, int h); @@ -97,7 +97,7 @@ class OpenGLGraphics : public Graphics void drawTile(ImageVertexes *vert); - void drawImagePattern2(GraphicsVertexes *vert, Image *image); + void drawImagePattern2(GraphicsVertexes *vert, const Image *image); void updateScreen(); |