comparison src/video/SDL_blit_0.c @ 2267:c785543d1843

Okay, still some bugs, but everything builds again...
author Sam Lantinga <slouken@libsdl.org>
date Sat, 18 Aug 2007 05:39:09 +0000
parents bee005ace1bf
children e1da92da346c
comparison
equal deleted inserted replaced
2266:e61ad15a205f 2267:c785543d1843
36 36
37 /* Set up some basic variables */ 37 /* Set up some basic variables */
38 width = info->dst_w; 38 width = info->dst_w;
39 height = info->dst_h; 39 height = info->dst_h;
40 src = info->src; 40 src = info->src;
41 srcskip = info->s_skip; 41 srcskip = info->src_skip;
42 dst = info->dst; 42 dst = info->dst;
43 dstskip = info->dst_pitch; 43 dstskip = info->dst_skip;
44 map = info->table; 44 map = info->table;
45 srcskip += width - (width + 7) / 8; 45 srcskip += width - (width + 7) / 8;
46 46
47 if (map) { 47 if (map) {
48 while (height--) { 48 while (height--) {
91 91
92 /* Set up some basic variables */ 92 /* Set up some basic variables */
93 width = info->dst_w; 93 width = info->dst_w;
94 height = info->dst_h; 94 height = info->dst_h;
95 src = info->src; 95 src = info->src;
96 srcskip = info->s_skip; 96 srcskip = info->src_skip;
97 dst = (Uint16 *) info->dst; 97 dst = (Uint16 *) info->dst;
98 dstskip = info->dst_pitch / 2; 98 dstskip = info->dst_skip / 2;
99 map = (Uint16 *) info->table; 99 map = (Uint16 *) info->table;
100 srcskip += width - (width + 7) / 8; 100 srcskip += width - (width + 7) / 8;
101 101
102 while (height--) { 102 while (height--) {
103 Uint8 byte = 0, bit; 103 Uint8 byte = 0, bit;
126 126
127 /* Set up some basic variables */ 127 /* Set up some basic variables */
128 width = info->dst_w; 128 width = info->dst_w;
129 height = info->dst_h; 129 height = info->dst_h;
130 src = info->src; 130 src = info->src;
131 srcskip = info->s_skip; 131 srcskip = info->src_skip;
132 dst = info->dst; 132 dst = info->dst;
133 dstskip = info->dst_pitch; 133 dstskip = info->dst_skip;
134 map = info->table; 134 map = info->table;
135 srcskip += width - (width + 7) / 8; 135 srcskip += width - (width + 7) / 8;
136 136
137 while (height--) { 137 while (height--) {
138 Uint8 byte = 0, bit; 138 Uint8 byte = 0, bit;
165 165
166 /* Set up some basic variables */ 166 /* Set up some basic variables */
167 width = info->dst_w; 167 width = info->dst_w;
168 height = info->dst_h; 168 height = info->dst_h;
169 src = info->src; 169 src = info->src;
170 srcskip = info->s_skip; 170 srcskip = info->src_skip;
171 dst = (Uint32 *) info->dst; 171 dst = (Uint32 *) info->dst;
172 dstskip = info->dst_pitch / 4; 172 dstskip = info->dst_skip / 4;
173 map = (Uint32 *) info->table; 173 map = (Uint32 *) info->table;
174 srcskip += width - (width + 7) / 8; 174 srcskip += width - (width + 7) / 8;
175 175
176 while (height--) { 176 while (height--) {
177 Uint8 byte = 0, bit; 177 Uint8 byte = 0, bit;
196 { 196 {
197 int width = info->dst_w; 197 int width = info->dst_w;
198 int height = info->dst_h; 198 int height = info->dst_h;
199 Uint8 *src = info->src; 199 Uint8 *src = info->src;
200 Uint8 *dst = info->dst; 200 Uint8 *dst = info->dst;
201 int srcskip = info->s_skip; 201 int srcskip = info->src_skip;
202 int dstskip = info->dst_pitch; 202 int dstskip = info->dst_skip;
203 Uint32 ckey = info->ckey; 203 Uint32 ckey = info->colorkey;
204 Uint8 *palmap = info->table; 204 Uint8 *palmap = info->table;
205 int c; 205 int c;
206 206
207 /* Set up some basic variables */ 207 /* Set up some basic variables */
208 srcskip += width - (width + 7) / 8; 208 srcskip += width - (width + 7) / 8;
249 { 249 {
250 int width = info->dst_w; 250 int width = info->dst_w;
251 int height = info->dst_h; 251 int height = info->dst_h;
252 Uint8 *src = info->src; 252 Uint8 *src = info->src;
253 Uint16 *dstp = (Uint16 *) info->dst; 253 Uint16 *dstp = (Uint16 *) info->dst;
254 int srcskip = info->s_skip; 254 int srcskip = info->src_skip;
255 int dstskip = info->dst_pitch; 255 int dstskip = info->dst_skip;
256 Uint32 ckey = info->ckey; 256 Uint32 ckey = info->colorkey;
257 Uint8 *palmap = info->table; 257 Uint8 *palmap = info->table;
258 int c; 258 int c;
259 259
260 /* Set up some basic variables */ 260 /* Set up some basic variables */
261 srcskip += width - (width + 7) / 8; 261 srcskip += width - (width + 7) / 8;
284 { 284 {
285 int width = info->dst_w; 285 int width = info->dst_w;
286 int height = info->dst_h; 286 int height = info->dst_h;
287 Uint8 *src = info->src; 287 Uint8 *src = info->src;
288 Uint8 *dst = info->dst; 288 Uint8 *dst = info->dst;
289 int srcskip = info->s_skip; 289 int srcskip = info->src_skip;
290 int dstskip = info->dst_pitch; 290 int dstskip = info->dst_skip;
291 Uint32 ckey = info->ckey; 291 Uint32 ckey = info->colorkey;
292 Uint8 *palmap = info->table; 292 Uint8 *palmap = info->table;
293 int c; 293 int c;
294 294
295 /* Set up some basic variables */ 295 /* Set up some basic variables */
296 srcskip += width - (width + 7) / 8; 296 srcskip += width - (width + 7) / 8;
318 { 318 {
319 int width = info->dst_w; 319 int width = info->dst_w;
320 int height = info->dst_h; 320 int height = info->dst_h;
321 Uint8 *src = info->src; 321 Uint8 *src = info->src;
322 Uint32 *dstp = (Uint32 *) info->dst; 322 Uint32 *dstp = (Uint32 *) info->dst;
323 int srcskip = info->s_skip; 323 int srcskip = info->src_skip;
324 int dstskip = info->dst_pitch; 324 int dstskip = info->dst_skip;
325 Uint32 ckey = info->ckey; 325 Uint32 ckey = info->colorkey;
326 Uint8 *palmap = info->table; 326 Uint8 *palmap = info->table;
327 int c; 327 int c;
328 328
329 /* Set up some basic variables */ 329 /* Set up some basic variables */
330 srcskip += width - (width + 7) / 8; 330 srcskip += width - (width + 7) / 8;
353 { 353 {
354 int width = info->dst_w; 354 int width = info->dst_w;
355 int height = info->dst_h; 355 int height = info->dst_h;
356 Uint8 *src = info->src; 356 Uint8 *src = info->src;
357 Uint8 *dst = info->dst; 357 Uint8 *dst = info->dst;
358 int srcskip = info->s_skip; 358 int srcskip = info->src_skip;
359 int dstskip = info->dst_pitch; 359 int dstskip = info->dst_skip;
360 const SDL_Color *srcpal = info->src->palette->colors; 360 const SDL_Color *srcpal = info->src_fmt->palette->colors;
361 SDL_PixelFormat *dstfmt = info->dst; 361 SDL_PixelFormat *dstfmt = info->dst_fmt;
362 int dstbpp; 362 int dstbpp;
363 int c; 363 int c;
364 const int A = (info->cmod >> 24); 364 const int A = info->a;
365 365
366 /* Set up some basic variables */ 366 /* Set up some basic variables */
367 dstbpp = dstfmt->BytesPerPixel; 367 dstbpp = dstfmt->BytesPerPixel;
368 srcskip += width - (width + 7) / 8; 368 srcskip += width - (width + 7) / 8;
369 369
398 { 398 {
399 int width = info->dst_w; 399 int width = info->dst_w;
400 int height = info->dst_h; 400 int height = info->dst_h;
401 Uint8 *src = info->src; 401 Uint8 *src = info->src;
402 Uint8 *dst = info->dst; 402 Uint8 *dst = info->dst;
403 int srcskip = info->s_skip; 403 int srcskip = info->src_skip;
404 int dstskip = info->dst_pitch; 404 int dstskip = info->dst_skip;
405 SDL_PixelFormat *srcfmt = info->src; 405 SDL_PixelFormat *srcfmt = info->src_fmt;
406 SDL_PixelFormat *dstfmt = info->dst; 406 SDL_PixelFormat *dstfmt = info->dst_fmt;
407 const SDL_Color *srcpal = srcfmt->palette->colors; 407 const SDL_Color *srcpal = srcfmt->palette->colors;
408 int dstbpp; 408 int dstbpp;
409 int c; 409 int c;
410 const int A = (info->cmod >> 24); 410 const int A = info->a;
411 Uint32 ckey = info->ckey; 411 Uint32 ckey = info->colorkey;
412 412
413 /* Set up some basic variables */ 413 /* Set up some basic variables */
414 dstbpp = dstfmt->BytesPerPixel; 414 dstbpp = dstfmt->BytesPerPixel;
415 srcskip += width - (width + 7) / 8; 415 srcskip += width - (width + 7) / 8;
416 416
438 src += srcskip; 438 src += srcskip;
439 dst += dstskip; 439 dst += dstskip;
440 } 440 }
441 } 441 }
442 442
443 static SDL_loblit bitmap_blit[] = { 443 static SDL_BlitFunc bitmap_blit[] = {
444 NULL, BlitBto1, BlitBto2, BlitBto3, BlitBto4 444 NULL, BlitBto1, BlitBto2, BlitBto3, BlitBto4
445 }; 445 };
446 446
447 static SDL_loblit colorkey_blit[] = { 447 static SDL_BlitFunc colorkey_blit[] = {
448 NULL, BlitBto1Key, BlitBto2Key, BlitBto3Key, BlitBto4Key 448 NULL, BlitBto1Key, BlitBto2Key, BlitBto3Key, BlitBto4Key
449 }; 449 };
450 450
451 SDL_loblit 451 SDL_BlitFunc
452 SDL_CalculateBlit0(SDL_Surface * surface, int blit_index) 452 SDL_CalculateBlit0(SDL_Surface * surface)
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 */
460 if (surface->map->dst->format->BitsPerPixel < 8) { 460 if (surface->map->dst->format->BitsPerPixel < 8) {
461 which = 0; 461 which = 0;
462 } else { 462 } else {
463 which = surface->map->dst->format->BytesPerPixel; 463 which = surface->map->dst->format->BytesPerPixel;
464 } 464 }
465 switch (blit_index) { 465 switch (surface->map->info.flags) {
466 case 0: /* copy */ 466 case 0:
467 return bitmap_blit[which]; 467 return bitmap_blit[which];
468 468
469 case 1: /* colorkey */ 469 case SDL_COPY_COLORKEY:
470 return colorkey_blit[which]; 470 return colorkey_blit[which];
471 471
472 case 2: /* alpha */ 472 case SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND:
473 return which >= 2 ? BlitBtoNAlpha : NULL; 473 return which >= 2 ? BlitBtoNAlpha : NULL;
474 474
475 case 4: /* alpha + colorkey */ 475 case SDL_COPY_COLORKEY | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND:
476 return which >= 2 ? BlitBtoNAlphaKey : NULL; 476 return which >= 2 ? BlitBtoNAlphaKey : NULL;
477 } 477 }
478 return NULL; 478 return NULL;
479 } 479 }
480 480