summaryrefslogtreecommitdiff
path: root/src/resources/sdlimagehelper.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-08-21 16:34:40 +0300
committerAndrei Karas <akaras@inbox.ru>2013-08-24 21:08:15 +0300
commit84189722a64c0794fbd918b4e6412908be2b7394 (patch)
tree7a9ed8e36889f2a6a5e49e98ae621fbd635bbb50 /src/resources/sdlimagehelper.cpp
parent31f6125fc7253e278bba5db46e08f370d92717c7 (diff)
downloadplus-84189722a64c0794fbd918b4e6412908be2b7394.tar.gz
plus-84189722a64c0794fbd918b4e6412908be2b7394.tar.bz2
plus-84189722a64c0794fbd918b4e6412908be2b7394.tar.xz
plus-84189722a64c0794fbd918b4e6412908be2b7394.zip
separate SDLGraphics and SDLImageHelper to 1.2 and 2.
add missing sdlshared.h
Diffstat (limited to 'src/resources/sdlimagehelper.cpp')
-rw-r--r--src/resources/sdlimagehelper.cpp15
1 files changed, 3 insertions, 12 deletions
diff --git a/src/resources/sdlimagehelper.cpp b/src/resources/sdlimagehelper.cpp
index 8f9d8b396..ca8978ded 100644
--- a/src/resources/sdlimagehelper.cpp
+++ b/src/resources/sdlimagehelper.cpp
@@ -20,6 +20,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#ifndef USE_SDL2
+
#include "resources/sdlimagehelper.h"
#include "resources/dye.h"
@@ -51,10 +53,8 @@ Image *SDLImageHelper::load(SDL_RWops *const rw, Dye const &dye) const
rgba.palette = nullptr;
rgba.BitsPerPixel = 32;
rgba.BytesPerPixel = 4;
-#ifndef USE_SDL2
rgba.colorkey = 0;
rgba.alpha = 255;
-#endif
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
rgba.Rmask = 0x000000FF;
@@ -119,10 +119,6 @@ Image *SDLImageHelper::createTextSurface(SDL_Surface *const tmpImage,
Image *img;
bool hasAlpha = false;
-#ifdef USE_SDL2
- uint8_t *alphaChannel = nullptr;
- SDL_Surface *image = SDLDuplicateSurface(tmpImage);
-#else
const int sz = tmpImage->w * tmpImage->h;
// The alpha channel to be filled with alpha values
@@ -176,7 +172,6 @@ Image *SDLImageHelper::createTextSurface(SDL_Surface *const tmpImage,
delete [] alphaChannel;
return nullptr;
}
-#endif
img = new Image(image, hasAlpha, alphaChannel);
img->mAlpha = alpha;
@@ -197,10 +192,6 @@ Image *SDLImageHelper::_SDLload(SDL_Surface *tmpImage) const
return nullptr;
bool hasAlpha = false;
-#ifdef USE_SDL2
- uint8_t *alphaChannel = nullptr;
- SDL_Surface *image = tmpImage;
-#else
bool converted = false;
if (tmpImage->format->BitsPerPixel != 32)
@@ -280,7 +271,6 @@ Image *SDLImageHelper::_SDLload(SDL_Surface *tmpImage) const
if (converted)
SDL_FreeSurface(tmpImage);
-#endif
return new Image(image, hasAlpha, alphaChannel);
}
@@ -306,3 +296,4 @@ SDL_Surface *SDLImageHelper::create32BitSurface(int width, int height) const
return SDL_CreateRGBSurface(SDL_SWSURFACE,
width, height, 32, rmask, gmask, bmask, amask);
}
+#endif // USE_SDL2