From 3f46cc367e9a8b4ad27b5001bb00102eb64012f2 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 1 Aug 2013 01:29:07 -0700 Subject: [PATCH] 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 | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/video/SDL_blit.h b/src/video/SDL_blit.h index 3e05bafd9..07d3af703 100644 --- a/src/video/SDL_blit.h +++ b/src/video/SDL_blit.h @@ -510,13 +510,15 @@ do { \ 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); \ } \ }