diff src/video/SDL_blendrect.c @ 2899:a0c837a16e4c

Added ARGB optimized case for Mac OS X
author Sam Lantinga <slouken@libsdl.org>
date Sun, 21 Dec 2008 08:55:06 +0000
parents e40448bc7727
children 3a9636c83849
line wrap: on
line diff
--- a/src/video/SDL_blendrect.c	Sun Dec 21 08:28:25 2008 +0000
+++ b/src/video/SDL_blendrect.c	Sun Dec 21 08:55:06 2008 +0000
@@ -94,6 +94,29 @@
 }
 
 static int
+SDL_BlendRect_ARGB8888(SDL_Surface * dst, SDL_Rect * dstrect, int blendMode,
+                       Uint8 r, Uint8 g, Uint8 b, Uint8 a)
+{
+    unsigned inva = 0xff - a;
+
+    switch (blendMode) {
+    case SDL_BLENDMODE_BLEND:
+        BLENDRECT(Uint32, DRAW_SETPIXEL_BLEND_ARGB8888);
+        break;
+    case SDL_BLENDMODE_ADD:
+        BLENDRECT(Uint32, DRAW_SETPIXEL_ADD_ARGB8888);
+        break;
+    case SDL_BLENDMODE_MOD:
+        BLENDRECT(Uint32, DRAW_SETPIXEL_MOD_ARGB8888);
+        break;
+    default:
+        BLENDRECT(Uint32, DRAW_SETPIXEL_ARGB8888);
+        break;
+    }
+    return 0;
+}
+
+static int
 SDL_BlendRect_RGB(SDL_Surface * dst, SDL_Rect * dstrect, int blendMode,
                   Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 {
@@ -217,6 +240,9 @@
             if (!fmt->Amask) {
                 return SDL_BlendRect_RGB888(dst, dstrect, blendMode, r, g, b,
                                             a);
+            } else {
+                return SDL_BlendRect_ARGB8888(dst, dstrect, blendMode, r, g,
+                                              b, a);
             }
             break;
         }