Fixed bug 1638 - Blit Alpha surface bug
authorSam Lantinga <slouken@libsdl.org>
Thu, 01 Aug 2013 01:29:07 -0700
changeset 7562 5287c82340e3
parent 7561 65f2b183e2aa
child 7563 c128ed448c30
Fixed bug 1638 - Blit Alpha surface bug The DUFFS_LOOP_124() macro was trying to be too clever and wasn't doing the right thing, it was checking n & 4 instead of width. I'm not sure how we didn't catch this before, but it should be fixed now.
src/video/SDL_blit.h
--- a/src/video/SDL_blit.h	Thu Aug 01 01:50:02 2013 -0400
+++ b/src/video/SDL_blit.h	Thu Aug 01 01:29:07 2013 -0700
@@ -510,13 +510,15 @@
     if (n & 2) {                                                        \
         pixel_copy_increment2; n -= 2;                                  \
     }                                                                   \
+    if (n & 4) {                                                        \
+        pixel_copy_increment4; n -= 4;                                  \
+    }                                                                   \
     if (n) {                                                            \
-        n = (n+7)/ 8;                                                   \
-        switch (n & 4) {                                                \
-        case 0: do {    pixel_copy_increment4;                          \
-        case 4:     pixel_copy_increment4;                              \
-            } while (--n > 0);                                          \
-        }                                                               \
+        n /= 8;                                                         \
+        do {                                                            \
+            pixel_copy_increment4;                                      \
+            pixel_copy_increment4;                                      \
+        } while (--n > 0);                                              \
     }                                                                   \
 }