summaryrefslogtreecommitdiff
path: root/src/resources/openglimagehelper.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-04-15 20:54:59 +0300
committerAndrei Karas <akaras@inbox.ru>2013-04-15 20:54:59 +0300
commit7b26645c1b28b212c011f98a5420c0989a7f0adc (patch)
tree0a3231b3cb54f415473c9834b88657b76b2668d6 /src/resources/openglimagehelper.cpp
parent054ed0b25bffc50588ff8c11a0aef4ee74c8136d (diff)
downloadmanaplus-7b26645c1b28b212c011f98a5420c0989a7f0adc.tar.gz
manaplus-7b26645c1b28b212c011f98a5420c0989a7f0adc.tar.bz2
manaplus-7b26645c1b28b212c011f98a5420c0989a7f0adc.tar.xz
manaplus-7b26645c1b28b212c011f98a5420c0989a7f0adc.zip
improve imagehelper class.
Diffstat (limited to 'src/resources/openglimagehelper.cpp')
-rw-r--r--src/resources/openglimagehelper.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/resources/openglimagehelper.cpp b/src/resources/openglimagehelper.cpp
index 9843d5026..a107b0099 100644
--- a/src/resources/openglimagehelper.cpp
+++ b/src/resources/openglimagehelper.cpp
@@ -51,7 +51,7 @@ bool OpenGLImageHelper::mBlur = true;
int OpenGLImageHelper::mUseOpenGL = 0;
bool OpenGLImageHelper::mUseTextureSampler = false;
-Image *OpenGLImageHelper::load(SDL_RWops *const rw, Dye const &dye)
+Image *OpenGLImageHelper::load(SDL_RWops *const rw, Dye const &dye) const
{
SDL_Surface *const tmpImage = loadPng(rw);
if (!tmpImage)
@@ -125,14 +125,14 @@ Image *OpenGLImageHelper::load(SDL_RWops *const rw, Dye const &dye)
return image;
}
-Image *OpenGLImageHelper::load(SDL_Surface *const tmpImage)
+Image *OpenGLImageHelper::load(SDL_Surface *const tmpImage) const
{
return glLoad(tmpImage);
}
Image *OpenGLImageHelper::createTextSurface(SDL_Surface *const tmpImage,
- int width, int height,
- const float alpha)
+ const int width, const int height,
+ const float alpha) const
{
if (!tmpImage)
return nullptr;
@@ -143,7 +143,7 @@ Image *OpenGLImageHelper::createTextSurface(SDL_Surface *const tmpImage,
return img;
}
-int OpenGLImageHelper::powerOfTwo(int input) const
+int OpenGLImageHelper::powerOfTwo(const int input) const
{
int value;
if (mTextureType == GL_TEXTURE_2D)
@@ -159,7 +159,8 @@ int OpenGLImageHelper::powerOfTwo(int input) const
return value >= mTextureSize ? mTextureSize : value;
}
-Image *OpenGLImageHelper::glLoad(SDL_Surface *tmpImage, int width, int height)
+Image *OpenGLImageHelper::glLoad(SDL_Surface *tmpImage,
+ int width, int height) const
{
if (!tmpImage)
return nullptr;
@@ -297,17 +298,17 @@ Image *OpenGLImageHelper::glLoad(SDL_Surface *tmpImage, int width, int height)
return new Image(texture, width, height, realWidth, realHeight);
}
-void OpenGLImageHelper::setLoadAsOpenGL(int useOpenGL)
+void OpenGLImageHelper::setLoadAsOpenGL(const int useOpenGL)
{
OpenGLImageHelper::mUseOpenGL = useOpenGL;
}
-int OpenGLImageHelper::useOpenGL()
+int OpenGLImageHelper::useOpenGL() const
{
return mUseOpenGL;
}
-void OpenGLImageHelper::initTextureSampler(GLint id)
+void OpenGLImageHelper::initTextureSampler(const GLint id)
{
if (mBlur)
{
@@ -321,7 +322,7 @@ void OpenGLImageHelper::initTextureSampler(GLint id)
}
}
-SDL_Surface *OpenGLImageHelper::create32BitSurface(int width, int height)
+SDL_Surface *OpenGLImageHelper::create32BitSurface(int width, int height) const
{
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
const int rmask = 0xff000000;