diff dmblit.c @ 610:e74ad60b1e85

Add new scaled surface conversion function.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 12 Apr 2013 12:32:24 +0300
parents 0430f484641b
children
line wrap: on
line diff
--- a/dmblit.c	Fri Apr 12 11:46:17 2013 +0300
+++ b/dmblit.c	Fri Apr 12 12:32:24 2013 +0300
@@ -235,3 +235,17 @@
 
     return bfunc(src, x0, y0, dst);
 }
+
+
+SDL_Surface *dmConvertScaledSurface(SDL_Surface *src, SDL_PixelFormat *fmt, Uint32 flags, const int dwidth, const int dheight)
+{
+    // Create the target surface
+    SDL_Surface *result = SDL_CreateRGBSurface(flags, dwidth, dheight, fmt->BitsPerPixel, fmt->Rmask, fmt->Gmask, fmt->Bmask, fmt->Amask);
+    if (result == NULL)
+        return NULL;
+    
+    // Use scaled blitting to convert the scaled image ..
+    dmScaledBlitSurfaceAny(src, 0, 0, dwidth, dheight, result, DMD_NONE);
+
+    return result;
+}