comparison 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
comparison
equal deleted inserted replaced
2898:e40448bc7727 2899:a0c837a16e4c
85 case SDL_BLENDMODE_MOD: 85 case SDL_BLENDMODE_MOD:
86 BRESENHAM(x1, y1, x2, y2, DRAW_SETPIXELXY_MOD_RGB888); 86 BRESENHAM(x1, y1, x2, y2, DRAW_SETPIXELXY_MOD_RGB888);
87 break; 87 break;
88 default: 88 default:
89 BRESENHAM(x1, y1, x2, y2, DRAW_SETPIXELXY_RGB888); 89 BRESENHAM(x1, y1, x2, y2, DRAW_SETPIXELXY_RGB888);
90 break;
91 }
92 return 0;
93 }
94
95 static int
96 SDL_BlendLine_ARGB8888(SDL_Surface * dst, int x1, int y1, int x2, int y2,
97 int blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
98 {
99 unsigned inva = 0xff - a;
100
101 switch (blendMode) {
102 case SDL_BLENDMODE_BLEND:
103 BRESENHAM(x1, y1, x2, y2, DRAW_SETPIXELXY_BLEND_ARGB8888);
104 break;
105 case SDL_BLENDMODE_ADD:
106 BRESENHAM(x1, y1, x2, y2, DRAW_SETPIXELXY_ADD_ARGB8888);
107 break;
108 case SDL_BLENDMODE_MOD:
109 BRESENHAM(x1, y1, x2, y2, DRAW_SETPIXELXY_MOD_ARGB8888);
110 break;
111 default:
112 BRESENHAM(x1, y1, x2, y2, DRAW_SETPIXELXY_ARGB8888);
90 break; 113 break;
91 } 114 }
92 return 0; 115 return 0;
93 } 116 }
94 117
213 switch (fmt->Rmask) { 236 switch (fmt->Rmask) {
214 case 0x00FF0000: 237 case 0x00FF0000:
215 if (!fmt->Amask) { 238 if (!fmt->Amask) {
216 return SDL_BlendLine_RGB888(dst, x1, y1, x2, y2, blendMode, r, 239 return SDL_BlendLine_RGB888(dst, x1, y1, x2, y2, blendMode, r,
217 g, b, a); 240 g, b, a);
241 } else {
242 return SDL_BlendLine_ARGB8888(dst, x1, y1, x2, y2, blendMode,
243 r, g, b, a);
218 } 244 }
219 break; 245 break;
220 } 246 }
221 default: 247 default:
222 break; 248 break;