summaryrefslogtreecommitdiff
path: root/src/resources
diff options
context:
space:
mode:
Diffstat (limited to 'src/resources')
-rw-r--r--src/resources/sdl2imagehelper.cpp10
-rw-r--r--src/resources/sdl2imagehelper.h5
-rw-r--r--src/resources/sdlimagehelper.cpp10
-rw-r--r--src/resources/sdlimagehelper.h5
4 files changed, 30 insertions, 0 deletions
diff --git a/src/resources/sdl2imagehelper.cpp b/src/resources/sdl2imagehelper.cpp
index a015080d4..acc72ce00 100644
--- a/src/resources/sdl2imagehelper.cpp
+++ b/src/resources/sdl2imagehelper.cpp
@@ -163,4 +163,14 @@ SDL_Surface *SDLImageHelper::create32BitSurface(int width, int height) const
width, height, 32, rmask, gmask, bmask, amask);
}
+int SDLImageHelper::combineSurface(SDL_Surface *const src,
+ SDL_Rect *const srcrect,
+ SDL_Surface *const dst,
+ SDL_Rect *const dstrect)
+{
+ SDL_SetSurfaceBlendMode (src, SDL_BLENDMODE_BLEND);
+ SDL_BlitSurface(src, srcrect, dst, dstrect);
+ return 1;
+}
+
#endif // USE_SDL2
diff --git a/src/resources/sdl2imagehelper.h b/src/resources/sdl2imagehelper.h
index e0629aea3..9edd48ebe 100644
--- a/src/resources/sdl2imagehelper.h
+++ b/src/resources/sdl2imagehelper.h
@@ -89,6 +89,11 @@ class SDLImageHelper final : public ImageHelper
SDL_Surface *create32BitSurface(int width, int height) const override;
+ static int combineSurface(SDL_Surface *const src,
+ SDL_Rect *const srcrect,
+ SDL_Surface *const dst,
+ SDL_Rect *const dstrect);
+
protected:
/** SDL_Surface to SDL_Surface Image loader */
Image *_SDLload(SDL_Surface *tmpImage) const A_WARN_UNUSED;
diff --git a/src/resources/sdlimagehelper.cpp b/src/resources/sdlimagehelper.cpp
index 7a1953444..7a7de1906 100644
--- a/src/resources/sdlimagehelper.cpp
+++ b/src/resources/sdlimagehelper.cpp
@@ -33,6 +33,7 @@
#include "resources/image.h"
+#include <SDL_gfxBlitFunc.h>
#include <SDL_image.h>
#include "debug.h"
@@ -295,4 +296,13 @@ SDL_Surface *SDLImageHelper::create32BitSurface(int width, int height) const
return SDL_CreateRGBSurface(SDL_SWSURFACE,
width, height, 32, rmask, gmask, bmask, amask);
}
+
+int SDLImageHelper::combineSurface(SDL_Surface *const src,
+ SDL_Rect *const srcrect,
+ SDL_Surface *const dst,
+ SDL_Rect *const dstrect)
+{
+ return SDL_gfxBlitRGBA(src, srcrect, dst, dstrect);
+}
+
#endif // USE_SDL2
diff --git a/src/resources/sdlimagehelper.h b/src/resources/sdlimagehelper.h
index 0aa3001b0..6f53c75ef 100644
--- a/src/resources/sdlimagehelper.h
+++ b/src/resources/sdlimagehelper.h
@@ -92,6 +92,11 @@ class SDLImageHelper final : public ImageHelper
SDL_Surface *create32BitSurface(int width, int height) const override;
+ static int combineSurface(SDL_Surface *const src,
+ SDL_Rect *const srcrect,
+ SDL_Surface *const dst,
+ SDL_Rect *const dstrect);
+
protected:
/** SDL_Surface to SDL_Surface Image loader */
Image *_SDLload(SDL_Surface *tmpImage) const A_WARN_UNUSED;