summaryrefslogtreecommitdiff
path: root/src/resources
diff options
context:
space:
mode:
Diffstat (limited to 'src/resources')
-rw-r--r--src/resources/imagehelper.h1
-rw-r--r--src/resources/openglimagehelper.cpp11
-rw-r--r--src/resources/openglimagehelper.h4
-rw-r--r--src/resources/sdlimagehelper.cpp1
-rw-r--r--src/resources/sdlimagehelper.h1
5 files changed, 13 insertions, 5 deletions
diff --git a/src/resources/imagehelper.h b/src/resources/imagehelper.h
index 83fc3e03c..39e088aa5 100644
--- a/src/resources/imagehelper.h
+++ b/src/resources/imagehelper.h
@@ -67,6 +67,7 @@ class ImageHelper
virtual Image *load(SDL_Surface *) A_WARN_UNUSED = 0;
virtual Image *createTextSurface(SDL_Surface *tmpImage,
+ int width, int height,
float alpha) A_WARN_UNUSED = 0;
virtual int useOpenGL() A_WARN_UNUSED = 0;
diff --git a/src/resources/openglimagehelper.cpp b/src/resources/openglimagehelper.cpp
index badaf0223..5eae5c667 100644
--- a/src/resources/openglimagehelper.cpp
+++ b/src/resources/openglimagehelper.cpp
@@ -132,12 +132,13 @@ Image *OpenGLImageHelper::load(SDL_Surface *const tmpImage)
}
Image *OpenGLImageHelper::createTextSurface(SDL_Surface *const tmpImage,
+ int width, int height,
const float alpha)
{
if (!tmpImage)
return nullptr;
- Image *const img = glLoad(tmpImage);
+ Image *const img = glLoad(tmpImage, width, height);
if (img)
img->setAlpha(alpha);
return img;
@@ -159,7 +160,7 @@ int OpenGLImageHelper::powerOfTwo(int input) const
return value >= mTextureSize ? mTextureSize : value;
}
-Image *OpenGLImageHelper::glLoad(SDL_Surface *tmpImage)
+Image *OpenGLImageHelper::glLoad(SDL_Surface *tmpImage, int width, int height)
{
if (!tmpImage)
return nullptr;
@@ -167,8 +168,10 @@ Image *OpenGLImageHelper::glLoad(SDL_Surface *tmpImage)
// Flush current error flag.
glGetError();
- int width = tmpImage->w;
- int height = tmpImage->h;
+ if (!width)
+ width = tmpImage->w;
+ if (!height)
+ height = tmpImage->h;
int realWidth = powerOfTwo(width);
int realHeight = powerOfTwo(height);
diff --git a/src/resources/openglimagehelper.h b/src/resources/openglimagehelper.h
index 0036bf007..30737dc36 100644
--- a/src/resources/openglimagehelper.h
+++ b/src/resources/openglimagehelper.h
@@ -86,6 +86,7 @@ class OpenGLImageHelper final : public ImageHelper
Image *load(SDL_Surface *const tmpImage) A_WARN_UNUSED;
Image *createTextSurface(SDL_Surface *const tmpImage,
+ int width, int height,
const float alpha) A_WARN_UNUSED;
// OpenGL only public functions
@@ -134,7 +135,8 @@ class OpenGLImageHelper final : public ImageHelper
*/
int powerOfTwo(int input) const A_WARN_UNUSED;
- Image *glLoad(SDL_Surface *tmpImage) A_WARN_UNUSED;
+ Image *glLoad(SDL_Surface *tmpImage,
+ int width = 0, int height = 0) A_WARN_UNUSED;
static int mUseOpenGL;
static int mTextureSize;
diff --git a/src/resources/sdlimagehelper.cpp b/src/resources/sdlimagehelper.cpp
index 82e476b8c..abc9ca068 100644
--- a/src/resources/sdlimagehelper.cpp
+++ b/src/resources/sdlimagehelper.cpp
@@ -129,6 +129,7 @@ Image *SDLImageHelper::load(SDL_Surface *const tmpImage)
}
Image *SDLImageHelper::createTextSurface(SDL_Surface *const tmpImage,
+ int width, int height,
const float alpha)
{
if (!tmpImage)
diff --git a/src/resources/sdlimagehelper.h b/src/resources/sdlimagehelper.h
index a0e19ca39..b37afaf2d 100644
--- a/src/resources/sdlimagehelper.h
+++ b/src/resources/sdlimagehelper.h
@@ -65,6 +65,7 @@ class SDLImageHelper final : public ImageHelper
Image *load(SDL_Surface *const tmpImage) A_WARN_UNUSED;
Image *createTextSurface(SDL_Surface *const tmpImage,
+ int width, int height,
const float alpha) A_WARN_UNUSED;
static void SDLSetEnableAlphaCache(const bool n)