diff src/video/SDL_blendline.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_blendline.c	Sun Dec 21 08:28:25 2008 +0000
+++ b/src/video/SDL_blendline.c	Sun Dec 21 08:55:06 2008 +0000
@@ -93,6 +93,29 @@
 }
 
 static int
+SDL_BlendLine_ARGB8888(SDL_Surface * dst, int x1, int y1, int x2, int y2,
+                       int blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
+{
+    unsigned inva = 0xff - a;
+
+    switch (blendMode) {
+    case SDL_BLENDMODE_BLEND:
+        BRESENHAM(x1, y1, x2, y2, DRAW_SETPIXELXY_BLEND_ARGB8888);
+        break;
+    case SDL_BLENDMODE_ADD:
+        BRESENHAM(x1, y1, x2, y2, DRAW_SETPIXELXY_ADD_ARGB8888);
+        break;
+    case SDL_BLENDMODE_MOD:
+        BRESENHAM(x1, y1, x2, y2, DRAW_SETPIXELXY_MOD_ARGB8888);
+        break;
+    default:
+        BRESENHAM(x1, y1, x2, y2, DRAW_SETPIXELXY_ARGB8888);
+        break;
+    }
+    return 0;
+}
+
+static int
 SDL_BlendLine_RGB(SDL_Surface * dst, int x1, int y1, int x2, int y2,
                   int blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 {
@@ -215,6 +238,9 @@
             if (!fmt->Amask) {
                 return SDL_BlendLine_RGB888(dst, x1, y1, x2, y2, blendMode, r,
                                             g, b, a);
+            } else {
+                return SDL_BlendLine_ARGB8888(dst, x1, y1, x2, y2, blendMode,
+                                              r, g, b, a);
             }
             break;
         }