diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-09-13 15:56:56 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-09-13 15:56:56 +0300 |
commit | cd0baf3217701134a8e61932fd14c39cec0cf242 (patch) | |
tree | 7d18a8b58d753865c3de9027fd384035375c7ab9 /src/resources | |
parent | e71aed97c2d885c8113561c1e0cad91454adeb57 (diff) | |
download | manaverse-cd0baf3217701134a8e61932fd14c39cec0cf242.tar.gz manaverse-cd0baf3217701134a8e61932fd14c39cec0cf242.tar.bz2 manaverse-cd0baf3217701134a8e61932fd14c39cec0cf242.tar.xz manaverse-cd0baf3217701134a8e61932fd14c39cec0cf242.zip |
Fix compilation errors with different flags.
Also fix renderer selection in build without OpenGL.
Diffstat (limited to 'src/resources')
-rw-r--r-- | src/resources/image.cpp | 4 | ||||
-rw-r--r-- | src/resources/imagehelper.cpp | 1 | ||||
-rw-r--r-- | src/resources/imagehelper.h | 12 | ||||
-rw-r--r-- | src/resources/openglimagehelper.cpp | 11 | ||||
-rw-r--r-- | src/resources/openglimagehelper.h | 13 | ||||
-rw-r--r-- | src/resources/sdl2imagehelper.cpp | 5 | ||||
-rw-r--r-- | src/resources/sdl2imagehelper.h | 6 | ||||
-rw-r--r-- | src/resources/sdl2softwareimagehelper.cpp | 5 | ||||
-rw-r--r-- | src/resources/sdl2softwareimagehelper.h | 6 | ||||
-rw-r--r-- | src/resources/sdlimagehelper.cpp | 5 | ||||
-rw-r--r-- | src/resources/sdlimagehelper.h | 6 |
11 files changed, 11 insertions, 63 deletions
diff --git a/src/resources/image.cpp b/src/resources/image.cpp index 1a327eae1..4cb9d7f1d 100644 --- a/src/resources/image.cpp +++ b/src/resources/image.cpp @@ -419,7 +419,9 @@ Image *Image::getSubImage(const int x, const int y, #endif #ifdef USE_SDL2 - // +++ probably default sdl render is broken here +#ifndef USE_OPENGL + const RenderType mode = ImageHelper::mUseOpenGL; +#endif if (mode == RENDER_SOFTWARE) return new SubImage(this, mSDLSurface, x, y, width, height); else diff --git a/src/resources/imagehelper.cpp b/src/resources/imagehelper.cpp index 8a97b4a81..c94016ca1 100644 --- a/src/resources/imagehelper.cpp +++ b/src/resources/imagehelper.cpp @@ -41,6 +41,7 @@ ImageHelper *imageHelper = nullptr; ImageHelper *surfaceImageHelper = nullptr; bool ImageHelper::mEnableAlpha = true; +RenderType ImageHelper::mUseOpenGL = RENDER_SOFTWARE; Image *ImageHelper::load(SDL_RWops *const rw) const { diff --git a/src/resources/imagehelper.h b/src/resources/imagehelper.h index b37d1e279..ed8f89323 100644 --- a/src/resources/imagehelper.h +++ b/src/resources/imagehelper.h @@ -72,8 +72,6 @@ class ImageHelper virtual Image *createTextSurface(SDL_Surface *const tmpImage, const int width, const int height, float alpha) const A_WARN_UNUSED = 0; - - virtual RenderType useOpenGL() const A_WARN_UNUSED = 0; #else virtual Image *load(SDL_RWops *rw, Dye const &dye) const A_WARN_UNUSED { return nullptr; } @@ -84,9 +82,6 @@ class ImageHelper virtual Image *createTextSurface(SDL_Surface *const tmpImage, const float alpha) const A_WARN_UNUSED { return nullptr; } - - virtual RenderType useOpenGL() const A_WARN_UNUSED - { return RENDER_SOFTWARE; } #endif static SDL_Surface *convertTo32Bit(SDL_Surface *const tmpImage) @@ -102,8 +97,15 @@ class ImageHelper static SDL_Surface *loadPng(SDL_RWops *const rw); + static void setOpenGlMode(const RenderType useOpenGL) + { mUseOpenGL = useOpenGL; } + + virtual RenderType useOpenGL() const A_WARN_UNUSED + { return mUseOpenGL; } + protected: static bool mEnableAlpha; + static RenderType mUseOpenGL; }; extern ImageHelper *imageHelper; diff --git a/src/resources/openglimagehelper.cpp b/src/resources/openglimagehelper.cpp index c41538b2e..014c33362 100644 --- a/src/resources/openglimagehelper.cpp +++ b/src/resources/openglimagehelper.cpp @@ -50,7 +50,6 @@ int OpenGLImageHelper::mTextureType = 0; int OpenGLImageHelper::mInternalTextureType = GL_RGBA8; int OpenGLImageHelper::mTextureSize = 0; bool OpenGLImageHelper::mBlur = true; -RenderType OpenGLImageHelper::mUseOpenGL = RENDER_SOFTWARE; bool OpenGLImageHelper::mUseTextureSampler = false; Image *OpenGLImageHelper::load(SDL_RWops *const rw, Dye const &dye) const @@ -279,16 +278,6 @@ Image *OpenGLImageHelper::glLoad(SDL_Surface *tmpImage, return new Image(texture, width, height, realWidth, realHeight); } -void OpenGLImageHelper::setLoadAsOpenGL(const RenderType useOpenGL) -{ - mUseOpenGL = useOpenGL; -} - -RenderType OpenGLImageHelper::useOpenGL() const -{ - return mUseOpenGL; -} - void OpenGLImageHelper::initTextureSampler(const GLint id) { if (mBlur) diff --git a/src/resources/openglimagehelper.h b/src/resources/openglimagehelper.h index 5ecf4512e..b8437e1aa 100644 --- a/src/resources/openglimagehelper.h +++ b/src/resources/openglimagehelper.h @@ -95,12 +95,6 @@ class OpenGLImageHelper final : public ImageHelper // OpenGL only public functions - /** - * Sets the target image format. Use <code>false</code> for SDL and - * <code>true</code> for OpenGL. - */ - static void setLoadAsOpenGL(const RenderType useOpenGL); - static int getTextureType() A_WARN_UNUSED { return mTextureType; } @@ -117,12 +111,6 @@ class OpenGLImageHelper final : public ImageHelper static int mInternalTextureType; - /** - * Tells if the image was loaded using OpenGL or SDL - * @return true if OpenGL, false if SDL. - */ - RenderType useOpenGL() const override A_WARN_UNUSED; - static int getTextureSize() A_WARN_UNUSED { return mTextureSize; } @@ -142,7 +130,6 @@ class OpenGLImageHelper final : public ImageHelper Image *glLoad(SDL_Surface *tmpImage, int width = 0, int height = 0) const A_WARN_UNUSED; - static RenderType mUseOpenGL; static int mTextureSize; static bool mBlur; static bool mUseTextureSampler; diff --git a/src/resources/sdl2imagehelper.cpp b/src/resources/sdl2imagehelper.cpp index 0433d2595..2ee72b0ee 100644 --- a/src/resources/sdl2imagehelper.cpp +++ b/src/resources/sdl2imagehelper.cpp @@ -146,11 +146,6 @@ Image *SDLImageHelper::_SDLload(SDL_Surface *tmpImage) const return new Image(texture, tmpImage->w, tmpImage->h); } -RenderType SDLImageHelper::useOpenGL() const -{ - return RENDER_SDL2_DEFAULT; -} - SDL_Surface *SDLImageHelper::create32BitSurface(int width, int height) const { #if SDL_BYTEORDER == SDL_BIG_ENDIAN diff --git a/src/resources/sdl2imagehelper.h b/src/resources/sdl2imagehelper.h index e0e0d0e9e..1790484e3 100644 --- a/src/resources/sdl2imagehelper.h +++ b/src/resources/sdl2imagehelper.h @@ -78,12 +78,6 @@ class SDLImageHelper final : public ImageHelper static bool SDLGetEnableAlphaCache() A_WARN_UNUSED { return mEnableAlphaCache; } - /** - * Tells if the image was loaded using OpenGL or SDL - * @return true if OpenGL, false if SDL. - */ - RenderType useOpenGL() const override A_WARN_UNUSED; - static SDL_Surface* SDLDuplicateSurface(SDL_Surface *const tmpImage) A_WARN_UNUSED; diff --git a/src/resources/sdl2softwareimagehelper.cpp b/src/resources/sdl2softwareimagehelper.cpp index 7c4ff3d5d..db41a4ddc 100644 --- a/src/resources/sdl2softwareimagehelper.cpp +++ b/src/resources/sdl2softwareimagehelper.cpp @@ -141,11 +141,6 @@ Image *SDL2SoftwareImageHelper::_SDLload(SDL_Surface *tmpImage) const return new Image(image, false, nullptr); } -RenderType SDL2SoftwareImageHelper::useOpenGL() const -{ - return RENDER_SOFTWARE; -} - SDL_Surface *SDL2SoftwareImageHelper::create32BitSurface(int width, int height) const { diff --git a/src/resources/sdl2softwareimagehelper.h b/src/resources/sdl2softwareimagehelper.h index 99a1a67e9..2eda73aa5 100644 --- a/src/resources/sdl2softwareimagehelper.h +++ b/src/resources/sdl2softwareimagehelper.h @@ -78,12 +78,6 @@ class SDL2SoftwareImageHelper final : public ImageHelper static bool SDLGetEnableAlphaCache() A_WARN_UNUSED { return mEnableAlphaCache; } - /** - * Tells if the image was loaded using OpenGL or SDL - * @return true if OpenGL, false if SDL. - */ - RenderType useOpenGL() const override A_WARN_UNUSED; - static SDL_Surface* SDLDuplicateSurface(SDL_Surface *const tmpImage) A_WARN_UNUSED; diff --git a/src/resources/sdlimagehelper.cpp b/src/resources/sdlimagehelper.cpp index 9742bbd5d..ad146aa22 100644 --- a/src/resources/sdlimagehelper.cpp +++ b/src/resources/sdlimagehelper.cpp @@ -276,11 +276,6 @@ Image *SDLImageHelper::_SDLload(SDL_Surface *tmpImage) const return new Image(image, hasAlpha, alphaChannel); } -RenderType SDLImageHelper::useOpenGL() const -{ - return RENDER_SOFTWARE; -} - SDL_Surface *SDLImageHelper::create32BitSurface(int width, int height) const { #if SDL_BYTEORDER == SDL_BIG_ENDIAN diff --git a/src/resources/sdlimagehelper.h b/src/resources/sdlimagehelper.h index 7d98e7fc4..5c3cabb09 100644 --- a/src/resources/sdlimagehelper.h +++ b/src/resources/sdlimagehelper.h @@ -81,12 +81,6 @@ class SDLImageHelper final : public ImageHelper static bool SDLGetEnableAlphaCache() A_WARN_UNUSED { return mEnableAlphaCache; } - /** - * Tells if the image was loaded using OpenGL or SDL - * @return true if OpenGL, false if SDL. - */ - RenderType useOpenGL() const override A_WARN_UNUSED; - static SDL_Surface* SDLDuplicateSurface(SDL_Surface *const tmpImage) A_WARN_UNUSED; |