Fixed bug 1638 - Blit Alpha surface bug
authorSam Lantinga
Thu, 01 Aug 2013 01:29:07 -0700
changeset 75625287c82340e3
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
     1.1 --- a/src/video/SDL_blit.h	Thu Aug 01 01:50:02 2013 -0400
     1.2 +++ b/src/video/SDL_blit.h	Thu Aug 01 01:29:07 2013 -0700
     1.3 @@ -510,13 +510,15 @@
     1.4      if (n & 2) {                                                        \
     1.5          pixel_copy_increment2; n -= 2;                                  \
     1.6      }                                                                   \
     1.7 +    if (n & 4) {                                                        \
     1.8 +        pixel_copy_increment4; n -= 4;                                  \
     1.9 +    }                                                                   \
    1.10      if (n) {                                                            \
    1.11 -        n = (n+7)/ 8;                                                   \
    1.12 -        switch (n & 4) {                                                \
    1.13 -        case 0: do {    pixel_copy_increment4;                          \
    1.14 -        case 4:     pixel_copy_increment4;                              \
    1.15 -            } while (--n > 0);                                          \
    1.16 -        }                                                               \
    1.17 +        n /= 8;                                                         \
    1.18 +        do {                                                            \
    1.19 +            pixel_copy_increment4;                                      \
    1.20 +            pixel_copy_increment4;                                      \
    1.21 +        } while (--n > 0);                                              \
    1.22      }                                                                   \
    1.23  }
    1.24