Fixed scaled blitting for complex blit operations (e.g. color modulation and alpha blending)
authorSam Lantinga <slouken@libsdl.org>
Mon, 01 Oct 2012 00:40:26 -0700
changeset 6526 e9c3a540c52f
parent 6525 04100177290e
child 6527 c04879cd3b57
Fixed scaled blitting for complex blit operations (e.g. color modulation and alpha blending)
src/video/SDL_surface.c
--- a/src/video/SDL_surface.c	Mon Oct 01 00:02:07 2012 -0700
+++ b/src/video/SDL_surface.c	Mon Oct 01 00:40:26 2012 -0700
@@ -684,6 +684,12 @@
 SDL_LowerBlitScaled(SDL_Surface * src, SDL_Rect * srcrect,
                 SDL_Surface * dst, SDL_Rect * dstrect)
 {
+    static const Uint32 complex_copy_flags = (
+        SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA |
+        SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD |
+        SDL_COPY_COLORKEY
+    );
+
     /* Save off the original dst width, height */
     int dstW = dstrect->w;
     int dstH = dstrect->h;
@@ -710,7 +716,9 @@
 
     src->map->info.flags |= SDL_COPY_NEAREST;
 
-    if ( src->format->format == dst->format->format && !SDL_ISPIXELFORMAT_INDEXED(src->format->format) ) {
+    if ( !(src->map->info.flags & complex_copy_flags) &&
+         src->format->format == dst->format->format && 
+         !SDL_ISPIXELFORMAT_INDEXED(src->format->format) ) {
         return SDL_SoftStretch( src, &final_src, dst, &final_dst );
     } else {
         return SDL_LowerBlit( src, &final_src, dst, &final_dst );