comparison src/video/SDL_blit_0.c @ 1668:4da1ee79c9af SDL-1.3

more tweaking indent options
author Sam Lantinga <slouken@libsdl.org>
date Mon, 29 May 2006 04:04:35 +0000
parents 782fd950bd46
children
comparison
equal deleted inserted replaced
1667:1fddae038bc8 1668:4da1ee79c9af
25 #include "SDL_blit.h" 25 #include "SDL_blit.h"
26 26
27 /* Functions to blit from bitmaps to other surfaces */ 27 /* Functions to blit from bitmaps to other surfaces */
28 28
29 static void 29 static void
30 BlitBto1 (SDL_BlitInfo * info) 30 BlitBto1(SDL_BlitInfo * info)
31 { 31 {
32 int c; 32 int c;
33 int width, height; 33 int width, height;
34 Uint8 *src, *map, *dst; 34 Uint8 *src, *map, *dst;
35 int srcskip, dstskip; 35 int srcskip, dstskip;
79 dst += dstskip; 79 dst += dstskip;
80 } 80 }
81 } 81 }
82 } 82 }
83 static void 83 static void
84 BlitBto2 (SDL_BlitInfo * info) 84 BlitBto2(SDL_BlitInfo * info)
85 { 85 {
86 int c; 86 int c;
87 int width, height; 87 int width, height;
88 Uint8 *src; 88 Uint8 *src;
89 Uint16 *map, *dst; 89 Uint16 *map, *dst;
115 src += srcskip; 115 src += srcskip;
116 dst += dstskip; 116 dst += dstskip;
117 } 117 }
118 } 118 }
119 static void 119 static void
120 BlitBto3 (SDL_BlitInfo * info) 120 BlitBto3(SDL_BlitInfo * info)
121 { 121 {
122 int c, o; 122 int c, o;
123 int width, height; 123 int width, height;
124 Uint8 *src, *map, *dst; 124 Uint8 *src, *map, *dst;
125 int srcskip, dstskip; 125 int srcskip, dstskip;
153 src += srcskip; 153 src += srcskip;
154 dst += dstskip; 154 dst += dstskip;
155 } 155 }
156 } 156 }
157 static void 157 static void
158 BlitBto4 (SDL_BlitInfo * info) 158 BlitBto4(SDL_BlitInfo * info)
159 { 159 {
160 int width, height; 160 int width, height;
161 Uint8 *src; 161 Uint8 *src;
162 Uint32 *map, *dst; 162 Uint32 *map, *dst;
163 int srcskip, dstskip; 163 int srcskip, dstskip;
190 dst += dstskip; 190 dst += dstskip;
191 } 191 }
192 } 192 }
193 193
194 static void 194 static void
195 BlitBto1Key (SDL_BlitInfo * info) 195 BlitBto1Key(SDL_BlitInfo * info)
196 { 196 {
197 int width = info->d_width; 197 int width = info->d_width;
198 int height = info->d_height; 198 int height = info->d_height;
199 Uint8 *src = info->s_pixels; 199 Uint8 *src = info->s_pixels;
200 Uint8 *dst = info->d_pixels; 200 Uint8 *dst = info->d_pixels;
243 } 243 }
244 } 244 }
245 } 245 }
246 246
247 static void 247 static void
248 BlitBto2Key (SDL_BlitInfo * info) 248 BlitBto2Key(SDL_BlitInfo * info)
249 { 249 {
250 int width = info->d_width; 250 int width = info->d_width;
251 int height = info->d_height; 251 int height = info->d_height;
252 Uint8 *src = info->s_pixels; 252 Uint8 *src = info->s_pixels;
253 Uint16 *dstp = (Uint16 *) info->d_pixels; 253 Uint16 *dstp = (Uint16 *) info->d_pixels;
278 dstp += dstskip; 278 dstp += dstskip;
279 } 279 }
280 } 280 }
281 281
282 static void 282 static void
283 BlitBto3Key (SDL_BlitInfo * info) 283 BlitBto3Key(SDL_BlitInfo * info)
284 { 284 {
285 int width = info->d_width; 285 int width = info->d_width;
286 int height = info->d_height; 286 int height = info->d_height;
287 Uint8 *src = info->s_pixels; 287 Uint8 *src = info->s_pixels;
288 Uint8 *dst = info->d_pixels; 288 Uint8 *dst = info->d_pixels;
301 if ((c & 7) == 0) { 301 if ((c & 7) == 0) {
302 byte = *src++; 302 byte = *src++;
303 } 303 }
304 bit = (byte & 0x80) >> 7; 304 bit = (byte & 0x80) >> 7;
305 if (bit != ckey) { 305 if (bit != ckey) {
306 SDL_memcpy (dst, &palmap[bit * 4], 3); 306 SDL_memcpy(dst, &palmap[bit * 4], 3);
307 } 307 }
308 byte <<= 1; 308 byte <<= 1;
309 dst += 3; 309 dst += 3;
310 } 310 }
311 src += srcskip; 311 src += srcskip;
312 dst += dstskip; 312 dst += dstskip;
313 } 313 }
314 } 314 }
315 315
316 static void 316 static void
317 BlitBto4Key (SDL_BlitInfo * info) 317 BlitBto4Key(SDL_BlitInfo * info)
318 { 318 {
319 int width = info->d_width; 319 int width = info->d_width;
320 int height = info->d_height; 320 int height = info->d_height;
321 Uint8 *src = info->s_pixels; 321 Uint8 *src = info->s_pixels;
322 Uint32 *dstp = (Uint32 *) info->d_pixels; 322 Uint32 *dstp = (Uint32 *) info->d_pixels;
347 dstp += dstskip; 347 dstp += dstskip;
348 } 348 }
349 } 349 }
350 350
351 static void 351 static void
352 BlitBtoNAlpha (SDL_BlitInfo * info) 352 BlitBtoNAlpha(SDL_BlitInfo * info)
353 { 353 {
354 int width = info->d_width; 354 int width = info->d_width;
355 int height = info->d_height; 355 int height = info->d_height;
356 Uint8 *src = info->s_pixels; 356 Uint8 *src = info->s_pixels;
357 Uint8 *dst = info->d_pixels; 357 Uint8 *dst = info->d_pixels;
379 unsigned sR, sG, sB; 379 unsigned sR, sG, sB;
380 unsigned dR, dG, dB; 380 unsigned dR, dG, dB;
381 sR = srcpal[bit].r; 381 sR = srcpal[bit].r;
382 sG = srcpal[bit].g; 382 sG = srcpal[bit].g;
383 sB = srcpal[bit].b; 383 sB = srcpal[bit].b;
384 DISEMBLE_RGB (dst, dstbpp, dstfmt, pixel, dR, dG, dB); 384 DISEMBLE_RGB(dst, dstbpp, dstfmt, pixel, dR, dG, dB);
385 ALPHA_BLEND (sR, sG, sB, A, dR, dG, dB); 385 ALPHA_BLEND(sR, sG, sB, A, dR, dG, dB);
386 ASSEMBLE_RGB (dst, dstbpp, dstfmt, dR, dG, dB); 386 ASSEMBLE_RGB(dst, dstbpp, dstfmt, dR, dG, dB);
387 } 387 }
388 byte <<= 1; 388 byte <<= 1;
389 dst += dstbpp; 389 dst += dstbpp;
390 } 390 }
391 src += srcskip; 391 src += srcskip;
392 dst += dstskip; 392 dst += dstskip;
393 } 393 }
394 } 394 }
395 395
396 static void 396 static void
397 BlitBtoNAlphaKey (SDL_BlitInfo * info) 397 BlitBtoNAlphaKey(SDL_BlitInfo * info)
398 { 398 {
399 int width = info->d_width; 399 int width = info->d_width;
400 int height = info->d_height; 400 int height = info->d_height;
401 Uint8 *src = info->s_pixels; 401 Uint8 *src = info->s_pixels;
402 Uint8 *dst = info->d_pixels; 402 Uint8 *dst = info->d_pixels;
426 int dR, dG, dB; 426 int dR, dG, dB;
427 Uint32 pixel; 427 Uint32 pixel;
428 sR = srcpal[bit].r; 428 sR = srcpal[bit].r;
429 sG = srcpal[bit].g; 429 sG = srcpal[bit].g;
430 sB = srcpal[bit].b; 430 sB = srcpal[bit].b;
431 DISEMBLE_RGB (dst, dstbpp, dstfmt, pixel, dR, dG, dB); 431 DISEMBLE_RGB(dst, dstbpp, dstfmt, pixel, dR, dG, dB);
432 ALPHA_BLEND (sR, sG, sB, A, dR, dG, dB); 432 ALPHA_BLEND(sR, sG, sB, A, dR, dG, dB);
433 ASSEMBLE_RGB (dst, dstbpp, dstfmt, dR, dG, dB); 433 ASSEMBLE_RGB(dst, dstbpp, dstfmt, dR, dG, dB);
434 } 434 }
435 byte <<= 1; 435 byte <<= 1;
436 dst += dstbpp; 436 dst += dstbpp;
437 } 437 }
438 src += srcskip; 438 src += srcskip;
447 static SDL_loblit colorkey_blit[] = { 447 static SDL_loblit colorkey_blit[] = {
448 NULL, BlitBto1Key, BlitBto2Key, BlitBto3Key, BlitBto4Key 448 NULL, BlitBto1Key, BlitBto2Key, BlitBto3Key, BlitBto4Key
449 }; 449 };
450 450
451 SDL_loblit 451 SDL_loblit
452 SDL_CalculateBlit0 (SDL_Surface * surface, int blit_index) 452 SDL_CalculateBlit0(SDL_Surface * surface, int blit_index)
453 { 453 {
454 int which; 454 int which;
455 455
456 if (surface->format->BitsPerPixel != 1) { 456 if (surface->format->BitsPerPixel != 1) {
457 /* We don't support sub 8-bit packed pixel modes */ 457 /* We don't support sub 8-bit packed pixel modes */