Mercurial > sdl-ios-xcode
comparison src/video/SDL_rendercopy.c @ 1989:5b5f5de5433f
Optimized the copy blitters a little bit
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 28 Aug 2006 14:10:46 +0000 |
parents | 8055185ae4ed |
children | 7387e0514595 |
comparison
equal
deleted
inserted
replaced
1988:1ee02169bbb0 | 1989:5b5f5de5433f |
---|---|
213 srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF; | 213 srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF; |
214 dstpixel = *dst; | 214 dstpixel = *dst; |
215 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; | 215 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; |
216 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { | 216 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { |
217 /* This goes away if we ever use premultiplied alpha */ | 217 /* This goes away if we ever use premultiplied alpha */ |
218 srcR = (srcR * srcA) / 255; | 218 if (srcA < 255) { |
219 srcG = (srcG * srcA) / 255; | 219 srcR = (srcR * srcA) / 255; |
220 srcB = (srcB * srcA) / 255; | 220 srcG = (srcG * srcA) / 255; |
221 } | 221 srcB = (srcB * srcA) / 255; |
222 switch (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | 222 } |
223 } | |
224 switch (flags & (SDL_RENDERCOPY_MASK|SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | |
225 case SDL_RENDERCOPY_MASK: | |
226 if (srcA) { | |
227 dstR = srcR; | |
228 dstG = srcG; | |
229 dstB = srcB; | |
230 } | |
231 break; | |
223 case SDL_RENDERCOPY_BLEND: | 232 case SDL_RENDERCOPY_BLEND: |
224 dstR = srcR + ((255 - srcA) * dstR) / 255; | 233 dstR = srcR + ((255 - srcA) * dstR) / 255; |
225 dstG = srcG + ((255 - srcA) * dstG) / 255; | 234 dstG = srcG + ((255 - srcA) * dstG) / 255; |
226 dstB = srcB + ((255 - srcA) * dstB) / 255; | 235 dstB = srcB + ((255 - srcA) * dstB) / 255; |
227 break; | 236 break; |
285 srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF; | 294 srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF; |
286 dstpixel = *dst; | 295 dstpixel = *dst; |
287 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; | 296 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; |
288 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { | 297 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { |
289 /* This goes away if we ever use premultiplied alpha */ | 298 /* This goes away if we ever use premultiplied alpha */ |
290 srcR = (srcR * srcA) / 255; | 299 if (srcA < 255) { |
291 srcG = (srcG * srcA) / 255; | 300 srcR = (srcR * srcA) / 255; |
292 srcB = (srcB * srcA) / 255; | 301 srcG = (srcG * srcA) / 255; |
293 } | 302 srcB = (srcB * srcA) / 255; |
294 switch (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | 303 } |
304 } | |
305 switch (flags & (SDL_RENDERCOPY_MASK|SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | |
306 case SDL_RENDERCOPY_MASK: | |
307 if (srcA) { | |
308 dstR = srcR; | |
309 dstG = srcG; | |
310 dstB = srcB; | |
311 } | |
312 break; | |
295 case SDL_RENDERCOPY_BLEND: | 313 case SDL_RENDERCOPY_BLEND: |
296 dstR = srcR + ((255 - srcA) * dstR) / 255; | 314 dstR = srcR + ((255 - srcA) * dstR) / 255; |
297 dstG = srcG + ((255 - srcA) * dstG) / 255; | 315 dstG = srcG + ((255 - srcA) * dstG) / 255; |
298 dstB = srcB + ((255 - srcA) * dstB) / 255; | 316 dstB = srcB + ((255 - srcA) * dstB) / 255; |
299 break; | 317 break; |
338 R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; A = 0xFF; | 356 R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; A = 0xFF; |
339 if (flags & SDL_RENDERCOPY_MODULATE_COLOR) { | 357 if (flags & SDL_RENDERCOPY_MODULATE_COLOR) { |
340 R = (R * modulateR) / 255; | 358 R = (R * modulateR) / 255; |
341 G = (G * modulateG) / 255; | 359 G = (G * modulateG) / 255; |
342 B = (B * modulateB) / 255; | 360 B = (B * modulateB) / 255; |
361 } | |
362 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { | |
363 A = (A * modulateA) / 255; | |
343 } | 364 } |
344 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; | 365 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; |
345 *dst = pixel; | 366 *dst = pixel; |
346 ++src; | 367 ++src; |
347 ++dst; | 368 ++dst; |
393 if (flags & SDL_RENDERCOPY_MODULATE_COLOR) { | 414 if (flags & SDL_RENDERCOPY_MODULATE_COLOR) { |
394 R = (R * modulateR) / 255; | 415 R = (R * modulateR) / 255; |
395 G = (G * modulateG) / 255; | 416 G = (G * modulateG) / 255; |
396 B = (B * modulateB) / 255; | 417 B = (B * modulateB) / 255; |
397 } | 418 } |
419 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { | |
420 A = (A * modulateA) / 255; | |
421 } | |
398 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; | 422 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; |
399 *dst = pixel; | 423 *dst = pixel; |
400 posx += incx; | 424 posx += incx; |
401 ++dst; | 425 ++dst; |
402 } | 426 } |
435 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { | 459 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { |
436 srcA = (srcA * modulateA) / 255; | 460 srcA = (srcA * modulateA) / 255; |
437 } | 461 } |
438 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { | 462 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { |
439 /* This goes away if we ever use premultiplied alpha */ | 463 /* This goes away if we ever use premultiplied alpha */ |
440 srcR = (srcR * srcA) / 255; | 464 if (srcA < 255) { |
441 srcG = (srcG * srcA) / 255; | 465 srcR = (srcR * srcA) / 255; |
442 srcB = (srcB * srcA) / 255; | 466 srcG = (srcG * srcA) / 255; |
443 } | 467 srcB = (srcB * srcA) / 255; |
444 switch (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | 468 } |
469 } | |
470 switch (flags & (SDL_RENDERCOPY_MASK|SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | |
471 case SDL_RENDERCOPY_MASK: | |
472 if (srcA) { | |
473 dstR = srcR; | |
474 dstG = srcG; | |
475 dstB = srcB; | |
476 } | |
477 break; | |
445 case SDL_RENDERCOPY_BLEND: | 478 case SDL_RENDERCOPY_BLEND: |
446 dstR = srcR + ((255 - srcA) * dstR) / 255; | 479 dstR = srcR + ((255 - srcA) * dstR) / 255; |
447 dstG = srcG + ((255 - srcA) * dstG) / 255; | 480 dstG = srcG + ((255 - srcA) * dstG) / 255; |
448 dstB = srcB + ((255 - srcA) * dstB) / 255; | 481 dstB = srcB + ((255 - srcA) * dstB) / 255; |
449 break; | 482 break; |
519 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { | 552 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { |
520 srcA = (srcA * modulateA) / 255; | 553 srcA = (srcA * modulateA) / 255; |
521 } | 554 } |
522 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { | 555 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { |
523 /* This goes away if we ever use premultiplied alpha */ | 556 /* This goes away if we ever use premultiplied alpha */ |
524 srcR = (srcR * srcA) / 255; | 557 if (srcA < 255) { |
525 srcG = (srcG * srcA) / 255; | 558 srcR = (srcR * srcA) / 255; |
526 srcB = (srcB * srcA) / 255; | 559 srcG = (srcG * srcA) / 255; |
527 } | 560 srcB = (srcB * srcA) / 255; |
528 switch (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | 561 } |
562 } | |
563 switch (flags & (SDL_RENDERCOPY_MASK|SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | |
564 case SDL_RENDERCOPY_MASK: | |
565 if (srcA) { | |
566 dstR = srcR; | |
567 dstG = srcG; | |
568 dstB = srcB; | |
569 } | |
570 break; | |
529 case SDL_RENDERCOPY_BLEND: | 571 case SDL_RENDERCOPY_BLEND: |
530 dstR = srcR + ((255 - srcA) * dstR) / 255; | 572 dstR = srcR + ((255 - srcA) * dstR) / 255; |
531 dstG = srcG + ((255 - srcA) * dstG) / 255; | 573 dstG = srcG + ((255 - srcA) * dstG) / 255; |
532 dstB = srcB + ((255 - srcA) * dstB) / 255; | 574 dstB = srcB + ((255 - srcA) * dstB) / 255; |
533 break; | 575 break; |
639 srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF; | 681 srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF; |
640 dstpixel = *dst; | 682 dstpixel = *dst; |
641 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; | 683 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; |
642 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { | 684 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { |
643 /* This goes away if we ever use premultiplied alpha */ | 685 /* This goes away if we ever use premultiplied alpha */ |
644 srcR = (srcR * srcA) / 255; | 686 if (srcA < 255) { |
645 srcG = (srcG * srcA) / 255; | 687 srcR = (srcR * srcA) / 255; |
646 srcB = (srcB * srcA) / 255; | 688 srcG = (srcG * srcA) / 255; |
647 } | 689 srcB = (srcB * srcA) / 255; |
648 switch (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | 690 } |
691 } | |
692 switch (flags & (SDL_RENDERCOPY_MASK|SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | |
693 case SDL_RENDERCOPY_MASK: | |
694 if (srcA) { | |
695 dstR = srcR; | |
696 dstG = srcG; | |
697 dstB = srcB; | |
698 } | |
699 break; | |
649 case SDL_RENDERCOPY_BLEND: | 700 case SDL_RENDERCOPY_BLEND: |
650 dstR = srcR + ((255 - srcA) * dstR) / 255; | 701 dstR = srcR + ((255 - srcA) * dstR) / 255; |
651 dstG = srcG + ((255 - srcA) * dstG) / 255; | 702 dstG = srcG + ((255 - srcA) * dstG) / 255; |
652 dstB = srcB + ((255 - srcA) * dstB) / 255; | 703 dstB = srcB + ((255 - srcA) * dstB) / 255; |
653 break; | 704 break; |
711 srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF; | 762 srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF; |
712 dstpixel = *dst; | 763 dstpixel = *dst; |
713 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; | 764 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; |
714 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { | 765 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { |
715 /* This goes away if we ever use premultiplied alpha */ | 766 /* This goes away if we ever use premultiplied alpha */ |
716 srcR = (srcR * srcA) / 255; | 767 if (srcA < 255) { |
717 srcG = (srcG * srcA) / 255; | 768 srcR = (srcR * srcA) / 255; |
718 srcB = (srcB * srcA) / 255; | 769 srcG = (srcG * srcA) / 255; |
719 } | 770 srcB = (srcB * srcA) / 255; |
720 switch (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | 771 } |
772 } | |
773 switch (flags & (SDL_RENDERCOPY_MASK|SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | |
774 case SDL_RENDERCOPY_MASK: | |
775 if (srcA) { | |
776 dstR = srcR; | |
777 dstG = srcG; | |
778 dstB = srcB; | |
779 } | |
780 break; | |
721 case SDL_RENDERCOPY_BLEND: | 781 case SDL_RENDERCOPY_BLEND: |
722 dstR = srcR + ((255 - srcA) * dstR) / 255; | 782 dstR = srcR + ((255 - srcA) * dstR) / 255; |
723 dstG = srcG + ((255 - srcA) * dstG) / 255; | 783 dstG = srcG + ((255 - srcA) * dstG) / 255; |
724 dstB = srcB + ((255 - srcA) * dstB) / 255; | 784 dstB = srcB + ((255 - srcA) * dstB) / 255; |
725 break; | 785 break; |
764 R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; A = 0xFF; | 824 R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; A = 0xFF; |
765 if (flags & SDL_RENDERCOPY_MODULATE_COLOR) { | 825 if (flags & SDL_RENDERCOPY_MODULATE_COLOR) { |
766 R = (R * modulateR) / 255; | 826 R = (R * modulateR) / 255; |
767 G = (G * modulateG) / 255; | 827 G = (G * modulateG) / 255; |
768 B = (B * modulateB) / 255; | 828 B = (B * modulateB) / 255; |
829 } | |
830 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { | |
831 A = (A * modulateA) / 255; | |
769 } | 832 } |
770 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; | 833 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; |
771 *dst = pixel; | 834 *dst = pixel; |
772 ++src; | 835 ++src; |
773 ++dst; | 836 ++dst; |
819 if (flags & SDL_RENDERCOPY_MODULATE_COLOR) { | 882 if (flags & SDL_RENDERCOPY_MODULATE_COLOR) { |
820 R = (R * modulateR) / 255; | 883 R = (R * modulateR) / 255; |
821 G = (G * modulateG) / 255; | 884 G = (G * modulateG) / 255; |
822 B = (B * modulateB) / 255; | 885 B = (B * modulateB) / 255; |
823 } | 886 } |
887 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { | |
888 A = (A * modulateA) / 255; | |
889 } | |
824 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; | 890 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; |
825 *dst = pixel; | 891 *dst = pixel; |
826 posx += incx; | 892 posx += incx; |
827 ++dst; | 893 ++dst; |
828 } | 894 } |
861 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { | 927 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { |
862 srcA = (srcA * modulateA) / 255; | 928 srcA = (srcA * modulateA) / 255; |
863 } | 929 } |
864 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { | 930 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { |
865 /* This goes away if we ever use premultiplied alpha */ | 931 /* This goes away if we ever use premultiplied alpha */ |
866 srcR = (srcR * srcA) / 255; | 932 if (srcA < 255) { |
867 srcG = (srcG * srcA) / 255; | 933 srcR = (srcR * srcA) / 255; |
868 srcB = (srcB * srcA) / 255; | 934 srcG = (srcG * srcA) / 255; |
869 } | 935 srcB = (srcB * srcA) / 255; |
870 switch (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | 936 } |
937 } | |
938 switch (flags & (SDL_RENDERCOPY_MASK|SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | |
939 case SDL_RENDERCOPY_MASK: | |
940 if (srcA) { | |
941 dstR = srcR; | |
942 dstG = srcG; | |
943 dstB = srcB; | |
944 } | |
945 break; | |
871 case SDL_RENDERCOPY_BLEND: | 946 case SDL_RENDERCOPY_BLEND: |
872 dstR = srcR + ((255 - srcA) * dstR) / 255; | 947 dstR = srcR + ((255 - srcA) * dstR) / 255; |
873 dstG = srcG + ((255 - srcA) * dstG) / 255; | 948 dstG = srcG + ((255 - srcA) * dstG) / 255; |
874 dstB = srcB + ((255 - srcA) * dstB) / 255; | 949 dstB = srcB + ((255 - srcA) * dstB) / 255; |
875 break; | 950 break; |
945 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { | 1020 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { |
946 srcA = (srcA * modulateA) / 255; | 1021 srcA = (srcA * modulateA) / 255; |
947 } | 1022 } |
948 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { | 1023 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { |
949 /* This goes away if we ever use premultiplied alpha */ | 1024 /* This goes away if we ever use premultiplied alpha */ |
950 srcR = (srcR * srcA) / 255; | 1025 if (srcA < 255) { |
951 srcG = (srcG * srcA) / 255; | 1026 srcR = (srcR * srcA) / 255; |
952 srcB = (srcB * srcA) / 255; | 1027 srcG = (srcG * srcA) / 255; |
953 } | 1028 srcB = (srcB * srcA) / 255; |
954 switch (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | 1029 } |
1030 } | |
1031 switch (flags & (SDL_RENDERCOPY_MASK|SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | |
1032 case SDL_RENDERCOPY_MASK: | |
1033 if (srcA) { | |
1034 dstR = srcR; | |
1035 dstG = srcG; | |
1036 dstB = srcB; | |
1037 } | |
1038 break; | |
955 case SDL_RENDERCOPY_BLEND: | 1039 case SDL_RENDERCOPY_BLEND: |
956 dstR = srcR + ((255 - srcA) * dstR) / 255; | 1040 dstR = srcR + ((255 - srcA) * dstR) / 255; |
957 dstG = srcG + ((255 - srcA) * dstG) / 255; | 1041 dstG = srcG + ((255 - srcA) * dstG) / 255; |
958 dstB = srcB + ((255 - srcA) * dstB) / 255; | 1042 dstB = srcB + ((255 - srcA) * dstB) / 255; |
959 break; | 1043 break; |
1065 srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF; | 1149 srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF; |
1066 dstpixel = *dst; | 1150 dstpixel = *dst; |
1067 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; | 1151 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; |
1068 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { | 1152 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { |
1069 /* This goes away if we ever use premultiplied alpha */ | 1153 /* This goes away if we ever use premultiplied alpha */ |
1070 srcR = (srcR * srcA) / 255; | 1154 if (srcA < 255) { |
1071 srcG = (srcG * srcA) / 255; | 1155 srcR = (srcR * srcA) / 255; |
1072 srcB = (srcB * srcA) / 255; | 1156 srcG = (srcG * srcA) / 255; |
1073 } | 1157 srcB = (srcB * srcA) / 255; |
1074 switch (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | 1158 } |
1159 } | |
1160 switch (flags & (SDL_RENDERCOPY_MASK|SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | |
1161 case SDL_RENDERCOPY_MASK: | |
1162 if (srcA) { | |
1163 dstR = srcR; | |
1164 dstG = srcG; | |
1165 dstB = srcB; | |
1166 } | |
1167 break; | |
1075 case SDL_RENDERCOPY_BLEND: | 1168 case SDL_RENDERCOPY_BLEND: |
1076 dstR = srcR + ((255 - srcA) * dstR) / 255; | 1169 dstR = srcR + ((255 - srcA) * dstR) / 255; |
1077 dstG = srcG + ((255 - srcA) * dstG) / 255; | 1170 dstG = srcG + ((255 - srcA) * dstG) / 255; |
1078 dstB = srcB + ((255 - srcA) * dstB) / 255; | 1171 dstB = srcB + ((255 - srcA) * dstB) / 255; |
1079 break; | 1172 break; |
1137 srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF; | 1230 srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF; |
1138 dstpixel = *dst; | 1231 dstpixel = *dst; |
1139 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; | 1232 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; |
1140 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { | 1233 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { |
1141 /* This goes away if we ever use premultiplied alpha */ | 1234 /* This goes away if we ever use premultiplied alpha */ |
1142 srcR = (srcR * srcA) / 255; | 1235 if (srcA < 255) { |
1143 srcG = (srcG * srcA) / 255; | 1236 srcR = (srcR * srcA) / 255; |
1144 srcB = (srcB * srcA) / 255; | 1237 srcG = (srcG * srcA) / 255; |
1145 } | 1238 srcB = (srcB * srcA) / 255; |
1146 switch (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | 1239 } |
1240 } | |
1241 switch (flags & (SDL_RENDERCOPY_MASK|SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | |
1242 case SDL_RENDERCOPY_MASK: | |
1243 if (srcA) { | |
1244 dstR = srcR; | |
1245 dstG = srcG; | |
1246 dstB = srcB; | |
1247 } | |
1248 break; | |
1147 case SDL_RENDERCOPY_BLEND: | 1249 case SDL_RENDERCOPY_BLEND: |
1148 dstR = srcR + ((255 - srcA) * dstR) / 255; | 1250 dstR = srcR + ((255 - srcA) * dstR) / 255; |
1149 dstG = srcG + ((255 - srcA) * dstG) / 255; | 1251 dstG = srcG + ((255 - srcA) * dstG) / 255; |
1150 dstB = srcB + ((255 - srcA) * dstB) / 255; | 1252 dstB = srcB + ((255 - srcA) * dstB) / 255; |
1151 break; | 1253 break; |
1190 B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; A = 0xFF; | 1292 B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; A = 0xFF; |
1191 if (flags & SDL_RENDERCOPY_MODULATE_COLOR) { | 1293 if (flags & SDL_RENDERCOPY_MODULATE_COLOR) { |
1192 R = (R * modulateR) / 255; | 1294 R = (R * modulateR) / 255; |
1193 G = (G * modulateG) / 255; | 1295 G = (G * modulateG) / 255; |
1194 B = (B * modulateB) / 255; | 1296 B = (B * modulateB) / 255; |
1297 } | |
1298 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { | |
1299 A = (A * modulateA) / 255; | |
1195 } | 1300 } |
1196 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; | 1301 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; |
1197 *dst = pixel; | 1302 *dst = pixel; |
1198 ++src; | 1303 ++src; |
1199 ++dst; | 1304 ++dst; |
1245 if (flags & SDL_RENDERCOPY_MODULATE_COLOR) { | 1350 if (flags & SDL_RENDERCOPY_MODULATE_COLOR) { |
1246 R = (R * modulateR) / 255; | 1351 R = (R * modulateR) / 255; |
1247 G = (G * modulateG) / 255; | 1352 G = (G * modulateG) / 255; |
1248 B = (B * modulateB) / 255; | 1353 B = (B * modulateB) / 255; |
1249 } | 1354 } |
1355 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { | |
1356 A = (A * modulateA) / 255; | |
1357 } | |
1250 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; | 1358 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; |
1251 *dst = pixel; | 1359 *dst = pixel; |
1252 posx += incx; | 1360 posx += incx; |
1253 ++dst; | 1361 ++dst; |
1254 } | 1362 } |
1287 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { | 1395 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { |
1288 srcA = (srcA * modulateA) / 255; | 1396 srcA = (srcA * modulateA) / 255; |
1289 } | 1397 } |
1290 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { | 1398 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { |
1291 /* This goes away if we ever use premultiplied alpha */ | 1399 /* This goes away if we ever use premultiplied alpha */ |
1292 srcR = (srcR * srcA) / 255; | 1400 if (srcA < 255) { |
1293 srcG = (srcG * srcA) / 255; | 1401 srcR = (srcR * srcA) / 255; |
1294 srcB = (srcB * srcA) / 255; | 1402 srcG = (srcG * srcA) / 255; |
1295 } | 1403 srcB = (srcB * srcA) / 255; |
1296 switch (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | 1404 } |
1405 } | |
1406 switch (flags & (SDL_RENDERCOPY_MASK|SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | |
1407 case SDL_RENDERCOPY_MASK: | |
1408 if (srcA) { | |
1409 dstR = srcR; | |
1410 dstG = srcG; | |
1411 dstB = srcB; | |
1412 } | |
1413 break; | |
1297 case SDL_RENDERCOPY_BLEND: | 1414 case SDL_RENDERCOPY_BLEND: |
1298 dstR = srcR + ((255 - srcA) * dstR) / 255; | 1415 dstR = srcR + ((255 - srcA) * dstR) / 255; |
1299 dstG = srcG + ((255 - srcA) * dstG) / 255; | 1416 dstG = srcG + ((255 - srcA) * dstG) / 255; |
1300 dstB = srcB + ((255 - srcA) * dstB) / 255; | 1417 dstB = srcB + ((255 - srcA) * dstB) / 255; |
1301 break; | 1418 break; |
1371 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { | 1488 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { |
1372 srcA = (srcA * modulateA) / 255; | 1489 srcA = (srcA * modulateA) / 255; |
1373 } | 1490 } |
1374 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { | 1491 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { |
1375 /* This goes away if we ever use premultiplied alpha */ | 1492 /* This goes away if we ever use premultiplied alpha */ |
1376 srcR = (srcR * srcA) / 255; | 1493 if (srcA < 255) { |
1377 srcG = (srcG * srcA) / 255; | 1494 srcR = (srcR * srcA) / 255; |
1378 srcB = (srcB * srcA) / 255; | 1495 srcG = (srcG * srcA) / 255; |
1379 } | 1496 srcB = (srcB * srcA) / 255; |
1380 switch (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | 1497 } |
1498 } | |
1499 switch (flags & (SDL_RENDERCOPY_MASK|SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | |
1500 case SDL_RENDERCOPY_MASK: | |
1501 if (srcA) { | |
1502 dstR = srcR; | |
1503 dstG = srcG; | |
1504 dstB = srcB; | |
1505 } | |
1506 break; | |
1381 case SDL_RENDERCOPY_BLEND: | 1507 case SDL_RENDERCOPY_BLEND: |
1382 dstR = srcR + ((255 - srcA) * dstR) / 255; | 1508 dstR = srcR + ((255 - srcA) * dstR) / 255; |
1383 dstG = srcG + ((255 - srcA) * dstG) / 255; | 1509 dstG = srcG + ((255 - srcA) * dstG) / 255; |
1384 dstB = srcB + ((255 - srcA) * dstB) / 255; | 1510 dstB = srcB + ((255 - srcA) * dstB) / 255; |
1385 break; | 1511 break; |
1462 srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF; | 1588 srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF; |
1463 dstpixel = *dst; | 1589 dstpixel = *dst; |
1464 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; | 1590 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; |
1465 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { | 1591 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { |
1466 /* This goes away if we ever use premultiplied alpha */ | 1592 /* This goes away if we ever use premultiplied alpha */ |
1467 srcR = (srcR * srcA) / 255; | 1593 if (srcA < 255) { |
1468 srcG = (srcG * srcA) / 255; | 1594 srcR = (srcR * srcA) / 255; |
1469 srcB = (srcB * srcA) / 255; | 1595 srcG = (srcG * srcA) / 255; |
1470 } | 1596 srcB = (srcB * srcA) / 255; |
1471 switch (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | 1597 } |
1598 } | |
1599 switch (flags & (SDL_RENDERCOPY_MASK|SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | |
1600 case SDL_RENDERCOPY_MASK: | |
1601 if (srcA) { | |
1602 dstR = srcR; | |
1603 dstG = srcG; | |
1604 dstB = srcB; | |
1605 } | |
1606 break; | |
1472 case SDL_RENDERCOPY_BLEND: | 1607 case SDL_RENDERCOPY_BLEND: |
1473 dstR = srcR + ((255 - srcA) * dstR) / 255; | 1608 dstR = srcR + ((255 - srcA) * dstR) / 255; |
1474 dstG = srcG + ((255 - srcA) * dstG) / 255; | 1609 dstG = srcG + ((255 - srcA) * dstG) / 255; |
1475 dstB = srcB + ((255 - srcA) * dstB) / 255; | 1610 dstB = srcB + ((255 - srcA) * dstB) / 255; |
1476 break; | 1611 break; |
1534 srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF; | 1669 srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF; |
1535 dstpixel = *dst; | 1670 dstpixel = *dst; |
1536 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; | 1671 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; |
1537 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { | 1672 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { |
1538 /* This goes away if we ever use premultiplied alpha */ | 1673 /* This goes away if we ever use premultiplied alpha */ |
1539 srcR = (srcR * srcA) / 255; | 1674 if (srcA < 255) { |
1540 srcG = (srcG * srcA) / 255; | 1675 srcR = (srcR * srcA) / 255; |
1541 srcB = (srcB * srcA) / 255; | 1676 srcG = (srcG * srcA) / 255; |
1542 } | 1677 srcB = (srcB * srcA) / 255; |
1543 switch (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | 1678 } |
1679 } | |
1680 switch (flags & (SDL_RENDERCOPY_MASK|SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | |
1681 case SDL_RENDERCOPY_MASK: | |
1682 if (srcA) { | |
1683 dstR = srcR; | |
1684 dstG = srcG; | |
1685 dstB = srcB; | |
1686 } | |
1687 break; | |
1544 case SDL_RENDERCOPY_BLEND: | 1688 case SDL_RENDERCOPY_BLEND: |
1545 dstR = srcR + ((255 - srcA) * dstR) / 255; | 1689 dstR = srcR + ((255 - srcA) * dstR) / 255; |
1546 dstG = srcG + ((255 - srcA) * dstG) / 255; | 1690 dstG = srcG + ((255 - srcA) * dstG) / 255; |
1547 dstB = srcB + ((255 - srcA) * dstB) / 255; | 1691 dstB = srcB + ((255 - srcA) * dstB) / 255; |
1548 break; | 1692 break; |
1587 B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; A = 0xFF; | 1731 B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; A = 0xFF; |
1588 if (flags & SDL_RENDERCOPY_MODULATE_COLOR) { | 1732 if (flags & SDL_RENDERCOPY_MODULATE_COLOR) { |
1589 R = (R * modulateR) / 255; | 1733 R = (R * modulateR) / 255; |
1590 G = (G * modulateG) / 255; | 1734 G = (G * modulateG) / 255; |
1591 B = (B * modulateB) / 255; | 1735 B = (B * modulateB) / 255; |
1736 } | |
1737 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { | |
1738 A = (A * modulateA) / 255; | |
1592 } | 1739 } |
1593 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; | 1740 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; |
1594 *dst = pixel; | 1741 *dst = pixel; |
1595 ++src; | 1742 ++src; |
1596 ++dst; | 1743 ++dst; |
1642 if (flags & SDL_RENDERCOPY_MODULATE_COLOR) { | 1789 if (flags & SDL_RENDERCOPY_MODULATE_COLOR) { |
1643 R = (R * modulateR) / 255; | 1790 R = (R * modulateR) / 255; |
1644 G = (G * modulateG) / 255; | 1791 G = (G * modulateG) / 255; |
1645 B = (B * modulateB) / 255; | 1792 B = (B * modulateB) / 255; |
1646 } | 1793 } |
1794 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { | |
1795 A = (A * modulateA) / 255; | |
1796 } | |
1647 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; | 1797 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; |
1648 *dst = pixel; | 1798 *dst = pixel; |
1649 posx += incx; | 1799 posx += incx; |
1650 ++dst; | 1800 ++dst; |
1651 } | 1801 } |
1684 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { | 1834 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { |
1685 srcA = (srcA * modulateA) / 255; | 1835 srcA = (srcA * modulateA) / 255; |
1686 } | 1836 } |
1687 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { | 1837 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { |
1688 /* This goes away if we ever use premultiplied alpha */ | 1838 /* This goes away if we ever use premultiplied alpha */ |
1689 srcR = (srcR * srcA) / 255; | 1839 if (srcA < 255) { |
1690 srcG = (srcG * srcA) / 255; | 1840 srcR = (srcR * srcA) / 255; |
1691 srcB = (srcB * srcA) / 255; | 1841 srcG = (srcG * srcA) / 255; |
1692 } | 1842 srcB = (srcB * srcA) / 255; |
1693 switch (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | 1843 } |
1844 } | |
1845 switch (flags & (SDL_RENDERCOPY_MASK|SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | |
1846 case SDL_RENDERCOPY_MASK: | |
1847 if (srcA) { | |
1848 dstR = srcR; | |
1849 dstG = srcG; | |
1850 dstB = srcB; | |
1851 } | |
1852 break; | |
1694 case SDL_RENDERCOPY_BLEND: | 1853 case SDL_RENDERCOPY_BLEND: |
1695 dstR = srcR + ((255 - srcA) * dstR) / 255; | 1854 dstR = srcR + ((255 - srcA) * dstR) / 255; |
1696 dstG = srcG + ((255 - srcA) * dstG) / 255; | 1855 dstG = srcG + ((255 - srcA) * dstG) / 255; |
1697 dstB = srcB + ((255 - srcA) * dstB) / 255; | 1856 dstB = srcB + ((255 - srcA) * dstB) / 255; |
1698 break; | 1857 break; |
1768 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { | 1927 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { |
1769 srcA = (srcA * modulateA) / 255; | 1928 srcA = (srcA * modulateA) / 255; |
1770 } | 1929 } |
1771 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { | 1930 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { |
1772 /* This goes away if we ever use premultiplied alpha */ | 1931 /* This goes away if we ever use premultiplied alpha */ |
1773 srcR = (srcR * srcA) / 255; | 1932 if (srcA < 255) { |
1774 srcG = (srcG * srcA) / 255; | 1933 srcR = (srcR * srcA) / 255; |
1775 srcB = (srcB * srcA) / 255; | 1934 srcG = (srcG * srcA) / 255; |
1776 } | 1935 srcB = (srcB * srcA) / 255; |
1777 switch (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | 1936 } |
1937 } | |
1938 switch (flags & (SDL_RENDERCOPY_MASK|SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | |
1939 case SDL_RENDERCOPY_MASK: | |
1940 if (srcA) { | |
1941 dstR = srcR; | |
1942 dstG = srcG; | |
1943 dstB = srcB; | |
1944 } | |
1945 break; | |
1778 case SDL_RENDERCOPY_BLEND: | 1946 case SDL_RENDERCOPY_BLEND: |
1779 dstR = srcR + ((255 - srcA) * dstR) / 255; | 1947 dstR = srcR + ((255 - srcA) * dstR) / 255; |
1780 dstG = srcG + ((255 - srcA) * dstG) / 255; | 1948 dstG = srcG + ((255 - srcA) * dstG) / 255; |
1781 dstB = srcB + ((255 - srcA) * dstB) / 255; | 1949 dstB = srcB + ((255 - srcA) * dstB) / 255; |
1782 break; | 1950 break; |
1888 srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; | 2056 srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; |
1889 dstpixel = *dst; | 2057 dstpixel = *dst; |
1890 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; | 2058 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; |
1891 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { | 2059 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { |
1892 /* This goes away if we ever use premultiplied alpha */ | 2060 /* This goes away if we ever use premultiplied alpha */ |
1893 srcR = (srcR * srcA) / 255; | 2061 if (srcA < 255) { |
1894 srcG = (srcG * srcA) / 255; | 2062 srcR = (srcR * srcA) / 255; |
1895 srcB = (srcB * srcA) / 255; | 2063 srcG = (srcG * srcA) / 255; |
1896 } | 2064 srcB = (srcB * srcA) / 255; |
1897 switch (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | 2065 } |
2066 } | |
2067 switch (flags & (SDL_RENDERCOPY_MASK|SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | |
2068 case SDL_RENDERCOPY_MASK: | |
2069 if (srcA) { | |
2070 dstR = srcR; | |
2071 dstG = srcG; | |
2072 dstB = srcB; | |
2073 } | |
2074 break; | |
1898 case SDL_RENDERCOPY_BLEND: | 2075 case SDL_RENDERCOPY_BLEND: |
1899 dstR = srcR + ((255 - srcA) * dstR) / 255; | 2076 dstR = srcR + ((255 - srcA) * dstR) / 255; |
1900 dstG = srcG + ((255 - srcA) * dstG) / 255; | 2077 dstG = srcG + ((255 - srcA) * dstG) / 255; |
1901 dstB = srcB + ((255 - srcA) * dstB) / 255; | 2078 dstB = srcB + ((255 - srcA) * dstB) / 255; |
1902 break; | 2079 break; |
1960 srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; | 2137 srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; |
1961 dstpixel = *dst; | 2138 dstpixel = *dst; |
1962 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; | 2139 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; |
1963 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { | 2140 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { |
1964 /* This goes away if we ever use premultiplied alpha */ | 2141 /* This goes away if we ever use premultiplied alpha */ |
1965 srcR = (srcR * srcA) / 255; | 2142 if (srcA < 255) { |
1966 srcG = (srcG * srcA) / 255; | 2143 srcR = (srcR * srcA) / 255; |
1967 srcB = (srcB * srcA) / 255; | 2144 srcG = (srcG * srcA) / 255; |
1968 } | 2145 srcB = (srcB * srcA) / 255; |
1969 switch (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | 2146 } |
2147 } | |
2148 switch (flags & (SDL_RENDERCOPY_MASK|SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | |
2149 case SDL_RENDERCOPY_MASK: | |
2150 if (srcA) { | |
2151 dstR = srcR; | |
2152 dstG = srcG; | |
2153 dstB = srcB; | |
2154 } | |
2155 break; | |
1970 case SDL_RENDERCOPY_BLEND: | 2156 case SDL_RENDERCOPY_BLEND: |
1971 dstR = srcR + ((255 - srcA) * dstR) / 255; | 2157 dstR = srcR + ((255 - srcA) * dstR) / 255; |
1972 dstG = srcG + ((255 - srcA) * dstG) / 255; | 2158 dstG = srcG + ((255 - srcA) * dstG) / 255; |
1973 dstB = srcB + ((255 - srcA) * dstB) / 255; | 2159 dstB = srcB + ((255 - srcA) * dstB) / 255; |
1974 break; | 2160 break; |
2013 A = (Uint8)(pixel >> 24); R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; | 2199 A = (Uint8)(pixel >> 24); R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; |
2014 if (flags & SDL_RENDERCOPY_MODULATE_COLOR) { | 2200 if (flags & SDL_RENDERCOPY_MODULATE_COLOR) { |
2015 R = (R * modulateR) / 255; | 2201 R = (R * modulateR) / 255; |
2016 G = (G * modulateG) / 255; | 2202 G = (G * modulateG) / 255; |
2017 B = (B * modulateB) / 255; | 2203 B = (B * modulateB) / 255; |
2204 } | |
2205 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { | |
2206 A = (A * modulateA) / 255; | |
2018 } | 2207 } |
2019 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; | 2208 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; |
2020 *dst = pixel; | 2209 *dst = pixel; |
2021 ++src; | 2210 ++src; |
2022 ++dst; | 2211 ++dst; |
2068 if (flags & SDL_RENDERCOPY_MODULATE_COLOR) { | 2257 if (flags & SDL_RENDERCOPY_MODULATE_COLOR) { |
2069 R = (R * modulateR) / 255; | 2258 R = (R * modulateR) / 255; |
2070 G = (G * modulateG) / 255; | 2259 G = (G * modulateG) / 255; |
2071 B = (B * modulateB) / 255; | 2260 B = (B * modulateB) / 255; |
2072 } | 2261 } |
2262 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { | |
2263 A = (A * modulateA) / 255; | |
2264 } | |
2073 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; | 2265 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; |
2074 *dst = pixel; | 2266 *dst = pixel; |
2075 posx += incx; | 2267 posx += incx; |
2076 ++dst; | 2268 ++dst; |
2077 } | 2269 } |
2110 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { | 2302 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { |
2111 srcA = (srcA * modulateA) / 255; | 2303 srcA = (srcA * modulateA) / 255; |
2112 } | 2304 } |
2113 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { | 2305 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { |
2114 /* This goes away if we ever use premultiplied alpha */ | 2306 /* This goes away if we ever use premultiplied alpha */ |
2115 srcR = (srcR * srcA) / 255; | 2307 if (srcA < 255) { |
2116 srcG = (srcG * srcA) / 255; | 2308 srcR = (srcR * srcA) / 255; |
2117 srcB = (srcB * srcA) / 255; | 2309 srcG = (srcG * srcA) / 255; |
2118 } | 2310 srcB = (srcB * srcA) / 255; |
2119 switch (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | 2311 } |
2312 } | |
2313 switch (flags & (SDL_RENDERCOPY_MASK|SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | |
2314 case SDL_RENDERCOPY_MASK: | |
2315 if (srcA) { | |
2316 dstR = srcR; | |
2317 dstG = srcG; | |
2318 dstB = srcB; | |
2319 } | |
2320 break; | |
2120 case SDL_RENDERCOPY_BLEND: | 2321 case SDL_RENDERCOPY_BLEND: |
2121 dstR = srcR + ((255 - srcA) * dstR) / 255; | 2322 dstR = srcR + ((255 - srcA) * dstR) / 255; |
2122 dstG = srcG + ((255 - srcA) * dstG) / 255; | 2323 dstG = srcG + ((255 - srcA) * dstG) / 255; |
2123 dstB = srcB + ((255 - srcA) * dstB) / 255; | 2324 dstB = srcB + ((255 - srcA) * dstB) / 255; |
2124 break; | 2325 break; |
2194 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { | 2395 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { |
2195 srcA = (srcA * modulateA) / 255; | 2396 srcA = (srcA * modulateA) / 255; |
2196 } | 2397 } |
2197 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { | 2398 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { |
2198 /* This goes away if we ever use premultiplied alpha */ | 2399 /* This goes away if we ever use premultiplied alpha */ |
2199 srcR = (srcR * srcA) / 255; | 2400 if (srcA < 255) { |
2200 srcG = (srcG * srcA) / 255; | 2401 srcR = (srcR * srcA) / 255; |
2201 srcB = (srcB * srcA) / 255; | 2402 srcG = (srcG * srcA) / 255; |
2202 } | 2403 srcB = (srcB * srcA) / 255; |
2203 switch (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | 2404 } |
2405 } | |
2406 switch (flags & (SDL_RENDERCOPY_MASK|SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | |
2407 case SDL_RENDERCOPY_MASK: | |
2408 if (srcA) { | |
2409 dstR = srcR; | |
2410 dstG = srcG; | |
2411 dstB = srcB; | |
2412 } | |
2413 break; | |
2204 case SDL_RENDERCOPY_BLEND: | 2414 case SDL_RENDERCOPY_BLEND: |
2205 dstR = srcR + ((255 - srcA) * dstR) / 255; | 2415 dstR = srcR + ((255 - srcA) * dstR) / 255; |
2206 dstG = srcG + ((255 - srcA) * dstG) / 255; | 2416 dstG = srcG + ((255 - srcA) * dstG) / 255; |
2207 dstB = srcB + ((255 - srcA) * dstB) / 255; | 2417 dstB = srcB + ((255 - srcA) * dstB) / 255; |
2208 break; | 2418 break; |
2314 srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; | 2524 srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; |
2315 dstpixel = *dst; | 2525 dstpixel = *dst; |
2316 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; | 2526 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; |
2317 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { | 2527 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { |
2318 /* This goes away if we ever use premultiplied alpha */ | 2528 /* This goes away if we ever use premultiplied alpha */ |
2319 srcR = (srcR * srcA) / 255; | 2529 if (srcA < 255) { |
2320 srcG = (srcG * srcA) / 255; | 2530 srcR = (srcR * srcA) / 255; |
2321 srcB = (srcB * srcA) / 255; | 2531 srcG = (srcG * srcA) / 255; |
2322 } | 2532 srcB = (srcB * srcA) / 255; |
2323 switch (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | 2533 } |
2534 } | |
2535 switch (flags & (SDL_RENDERCOPY_MASK|SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | |
2536 case SDL_RENDERCOPY_MASK: | |
2537 if (srcA) { | |
2538 dstR = srcR; | |
2539 dstG = srcG; | |
2540 dstB = srcB; | |
2541 } | |
2542 break; | |
2324 case SDL_RENDERCOPY_BLEND: | 2543 case SDL_RENDERCOPY_BLEND: |
2325 dstR = srcR + ((255 - srcA) * dstR) / 255; | 2544 dstR = srcR + ((255 - srcA) * dstR) / 255; |
2326 dstG = srcG + ((255 - srcA) * dstG) / 255; | 2545 dstG = srcG + ((255 - srcA) * dstG) / 255; |
2327 dstB = srcB + ((255 - srcA) * dstB) / 255; | 2546 dstB = srcB + ((255 - srcA) * dstB) / 255; |
2328 break; | 2547 break; |
2386 srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; | 2605 srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; |
2387 dstpixel = *dst; | 2606 dstpixel = *dst; |
2388 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; | 2607 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; |
2389 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { | 2608 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { |
2390 /* This goes away if we ever use premultiplied alpha */ | 2609 /* This goes away if we ever use premultiplied alpha */ |
2391 srcR = (srcR * srcA) / 255; | 2610 if (srcA < 255) { |
2392 srcG = (srcG * srcA) / 255; | 2611 srcR = (srcR * srcA) / 255; |
2393 srcB = (srcB * srcA) / 255; | 2612 srcG = (srcG * srcA) / 255; |
2394 } | 2613 srcB = (srcB * srcA) / 255; |
2395 switch (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | 2614 } |
2615 } | |
2616 switch (flags & (SDL_RENDERCOPY_MASK|SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | |
2617 case SDL_RENDERCOPY_MASK: | |
2618 if (srcA) { | |
2619 dstR = srcR; | |
2620 dstG = srcG; | |
2621 dstB = srcB; | |
2622 } | |
2623 break; | |
2396 case SDL_RENDERCOPY_BLEND: | 2624 case SDL_RENDERCOPY_BLEND: |
2397 dstR = srcR + ((255 - srcA) * dstR) / 255; | 2625 dstR = srcR + ((255 - srcA) * dstR) / 255; |
2398 dstG = srcG + ((255 - srcA) * dstG) / 255; | 2626 dstG = srcG + ((255 - srcA) * dstG) / 255; |
2399 dstB = srcB + ((255 - srcA) * dstB) / 255; | 2627 dstB = srcB + ((255 - srcA) * dstB) / 255; |
2400 break; | 2628 break; |
2439 A = (Uint8)(pixel >> 24); R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; | 2667 A = (Uint8)(pixel >> 24); R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; |
2440 if (flags & SDL_RENDERCOPY_MODULATE_COLOR) { | 2668 if (flags & SDL_RENDERCOPY_MODULATE_COLOR) { |
2441 R = (R * modulateR) / 255; | 2669 R = (R * modulateR) / 255; |
2442 G = (G * modulateG) / 255; | 2670 G = (G * modulateG) / 255; |
2443 B = (B * modulateB) / 255; | 2671 B = (B * modulateB) / 255; |
2672 } | |
2673 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { | |
2674 A = (A * modulateA) / 255; | |
2444 } | 2675 } |
2445 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; | 2676 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; |
2446 *dst = pixel; | 2677 *dst = pixel; |
2447 ++src; | 2678 ++src; |
2448 ++dst; | 2679 ++dst; |
2494 if (flags & SDL_RENDERCOPY_MODULATE_COLOR) { | 2725 if (flags & SDL_RENDERCOPY_MODULATE_COLOR) { |
2495 R = (R * modulateR) / 255; | 2726 R = (R * modulateR) / 255; |
2496 G = (G * modulateG) / 255; | 2727 G = (G * modulateG) / 255; |
2497 B = (B * modulateB) / 255; | 2728 B = (B * modulateB) / 255; |
2498 } | 2729 } |
2730 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { | |
2731 A = (A * modulateA) / 255; | |
2732 } | |
2499 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; | 2733 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; |
2500 *dst = pixel; | 2734 *dst = pixel; |
2501 posx += incx; | 2735 posx += incx; |
2502 ++dst; | 2736 ++dst; |
2503 } | 2737 } |
2536 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { | 2770 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { |
2537 srcA = (srcA * modulateA) / 255; | 2771 srcA = (srcA * modulateA) / 255; |
2538 } | 2772 } |
2539 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { | 2773 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { |
2540 /* This goes away if we ever use premultiplied alpha */ | 2774 /* This goes away if we ever use premultiplied alpha */ |
2541 srcR = (srcR * srcA) / 255; | 2775 if (srcA < 255) { |
2542 srcG = (srcG * srcA) / 255; | 2776 srcR = (srcR * srcA) / 255; |
2543 srcB = (srcB * srcA) / 255; | 2777 srcG = (srcG * srcA) / 255; |
2544 } | 2778 srcB = (srcB * srcA) / 255; |
2545 switch (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | 2779 } |
2780 } | |
2781 switch (flags & (SDL_RENDERCOPY_MASK|SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | |
2782 case SDL_RENDERCOPY_MASK: | |
2783 if (srcA) { | |
2784 dstR = srcR; | |
2785 dstG = srcG; | |
2786 dstB = srcB; | |
2787 } | |
2788 break; | |
2546 case SDL_RENDERCOPY_BLEND: | 2789 case SDL_RENDERCOPY_BLEND: |
2547 dstR = srcR + ((255 - srcA) * dstR) / 255; | 2790 dstR = srcR + ((255 - srcA) * dstR) / 255; |
2548 dstG = srcG + ((255 - srcA) * dstG) / 255; | 2791 dstG = srcG + ((255 - srcA) * dstG) / 255; |
2549 dstB = srcB + ((255 - srcA) * dstB) / 255; | 2792 dstB = srcB + ((255 - srcA) * dstB) / 255; |
2550 break; | 2793 break; |
2620 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { | 2863 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { |
2621 srcA = (srcA * modulateA) / 255; | 2864 srcA = (srcA * modulateA) / 255; |
2622 } | 2865 } |
2623 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { | 2866 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { |
2624 /* This goes away if we ever use premultiplied alpha */ | 2867 /* This goes away if we ever use premultiplied alpha */ |
2625 srcR = (srcR * srcA) / 255; | 2868 if (srcA < 255) { |
2626 srcG = (srcG * srcA) / 255; | 2869 srcR = (srcR * srcA) / 255; |
2627 srcB = (srcB * srcA) / 255; | 2870 srcG = (srcG * srcA) / 255; |
2628 } | 2871 srcB = (srcB * srcA) / 255; |
2629 switch (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | 2872 } |
2873 } | |
2874 switch (flags & (SDL_RENDERCOPY_MASK|SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | |
2875 case SDL_RENDERCOPY_MASK: | |
2876 if (srcA) { | |
2877 dstR = srcR; | |
2878 dstG = srcG; | |
2879 dstB = srcB; | |
2880 } | |
2881 break; | |
2630 case SDL_RENDERCOPY_BLEND: | 2882 case SDL_RENDERCOPY_BLEND: |
2631 dstR = srcR + ((255 - srcA) * dstR) / 255; | 2883 dstR = srcR + ((255 - srcA) * dstR) / 255; |
2632 dstG = srcG + ((255 - srcA) * dstG) / 255; | 2884 dstG = srcG + ((255 - srcA) * dstG) / 255; |
2633 dstB = srcB + ((255 - srcA) * dstB) / 255; | 2885 dstB = srcB + ((255 - srcA) * dstB) / 255; |
2634 break; | 2886 break; |
2740 srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; | 2992 srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; |
2741 dstpixel = *dst; | 2993 dstpixel = *dst; |
2742 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; | 2994 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; |
2743 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { | 2995 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { |
2744 /* This goes away if we ever use premultiplied alpha */ | 2996 /* This goes away if we ever use premultiplied alpha */ |
2745 srcR = (srcR * srcA) / 255; | 2997 if (srcA < 255) { |
2746 srcG = (srcG * srcA) / 255; | 2998 srcR = (srcR * srcA) / 255; |
2747 srcB = (srcB * srcA) / 255; | 2999 srcG = (srcG * srcA) / 255; |
2748 } | 3000 srcB = (srcB * srcA) / 255; |
2749 switch (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | 3001 } |
3002 } | |
3003 switch (flags & (SDL_RENDERCOPY_MASK|SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | |
3004 case SDL_RENDERCOPY_MASK: | |
3005 if (srcA) { | |
3006 dstR = srcR; | |
3007 dstG = srcG; | |
3008 dstB = srcB; | |
3009 } | |
3010 break; | |
2750 case SDL_RENDERCOPY_BLEND: | 3011 case SDL_RENDERCOPY_BLEND: |
2751 dstR = srcR + ((255 - srcA) * dstR) / 255; | 3012 dstR = srcR + ((255 - srcA) * dstR) / 255; |
2752 dstG = srcG + ((255 - srcA) * dstG) / 255; | 3013 dstG = srcG + ((255 - srcA) * dstG) / 255; |
2753 dstB = srcB + ((255 - srcA) * dstB) / 255; | 3014 dstB = srcB + ((255 - srcA) * dstB) / 255; |
2754 break; | 3015 break; |
2812 srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; | 3073 srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; |
2813 dstpixel = *dst; | 3074 dstpixel = *dst; |
2814 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; | 3075 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; |
2815 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { | 3076 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { |
2816 /* This goes away if we ever use premultiplied alpha */ | 3077 /* This goes away if we ever use premultiplied alpha */ |
2817 srcR = (srcR * srcA) / 255; | 3078 if (srcA < 255) { |
2818 srcG = (srcG * srcA) / 255; | 3079 srcR = (srcR * srcA) / 255; |
2819 srcB = (srcB * srcA) / 255; | 3080 srcG = (srcG * srcA) / 255; |
2820 } | 3081 srcB = (srcB * srcA) / 255; |
2821 switch (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | 3082 } |
3083 } | |
3084 switch (flags & (SDL_RENDERCOPY_MASK|SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | |
3085 case SDL_RENDERCOPY_MASK: | |
3086 if (srcA) { | |
3087 dstR = srcR; | |
3088 dstG = srcG; | |
3089 dstB = srcB; | |
3090 } | |
3091 break; | |
2822 case SDL_RENDERCOPY_BLEND: | 3092 case SDL_RENDERCOPY_BLEND: |
2823 dstR = srcR + ((255 - srcA) * dstR) / 255; | 3093 dstR = srcR + ((255 - srcA) * dstR) / 255; |
2824 dstG = srcG + ((255 - srcA) * dstG) / 255; | 3094 dstG = srcG + ((255 - srcA) * dstG) / 255; |
2825 dstB = srcB + ((255 - srcA) * dstB) / 255; | 3095 dstB = srcB + ((255 - srcA) * dstB) / 255; |
2826 break; | 3096 break; |
2865 R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel; | 3135 R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel; |
2866 if (flags & SDL_RENDERCOPY_MODULATE_COLOR) { | 3136 if (flags & SDL_RENDERCOPY_MODULATE_COLOR) { |
2867 R = (R * modulateR) / 255; | 3137 R = (R * modulateR) / 255; |
2868 G = (G * modulateG) / 255; | 3138 G = (G * modulateG) / 255; |
2869 B = (B * modulateB) / 255; | 3139 B = (B * modulateB) / 255; |
3140 } | |
3141 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { | |
3142 A = (A * modulateA) / 255; | |
2870 } | 3143 } |
2871 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; | 3144 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; |
2872 *dst = pixel; | 3145 *dst = pixel; |
2873 ++src; | 3146 ++src; |
2874 ++dst; | 3147 ++dst; |
2920 if (flags & SDL_RENDERCOPY_MODULATE_COLOR) { | 3193 if (flags & SDL_RENDERCOPY_MODULATE_COLOR) { |
2921 R = (R * modulateR) / 255; | 3194 R = (R * modulateR) / 255; |
2922 G = (G * modulateG) / 255; | 3195 G = (G * modulateG) / 255; |
2923 B = (B * modulateB) / 255; | 3196 B = (B * modulateB) / 255; |
2924 } | 3197 } |
3198 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { | |
3199 A = (A * modulateA) / 255; | |
3200 } | |
2925 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; | 3201 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; |
2926 *dst = pixel; | 3202 *dst = pixel; |
2927 posx += incx; | 3203 posx += incx; |
2928 ++dst; | 3204 ++dst; |
2929 } | 3205 } |
2962 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { | 3238 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { |
2963 srcA = (srcA * modulateA) / 255; | 3239 srcA = (srcA * modulateA) / 255; |
2964 } | 3240 } |
2965 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { | 3241 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { |
2966 /* This goes away if we ever use premultiplied alpha */ | 3242 /* This goes away if we ever use premultiplied alpha */ |
2967 srcR = (srcR * srcA) / 255; | 3243 if (srcA < 255) { |
2968 srcG = (srcG * srcA) / 255; | 3244 srcR = (srcR * srcA) / 255; |
2969 srcB = (srcB * srcA) / 255; | 3245 srcG = (srcG * srcA) / 255; |
2970 } | 3246 srcB = (srcB * srcA) / 255; |
2971 switch (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | 3247 } |
3248 } | |
3249 switch (flags & (SDL_RENDERCOPY_MASK|SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | |
3250 case SDL_RENDERCOPY_MASK: | |
3251 if (srcA) { | |
3252 dstR = srcR; | |
3253 dstG = srcG; | |
3254 dstB = srcB; | |
3255 } | |
3256 break; | |
2972 case SDL_RENDERCOPY_BLEND: | 3257 case SDL_RENDERCOPY_BLEND: |
2973 dstR = srcR + ((255 - srcA) * dstR) / 255; | 3258 dstR = srcR + ((255 - srcA) * dstR) / 255; |
2974 dstG = srcG + ((255 - srcA) * dstG) / 255; | 3259 dstG = srcG + ((255 - srcA) * dstG) / 255; |
2975 dstB = srcB + ((255 - srcA) * dstB) / 255; | 3260 dstB = srcB + ((255 - srcA) * dstB) / 255; |
2976 break; | 3261 break; |
3046 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { | 3331 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { |
3047 srcA = (srcA * modulateA) / 255; | 3332 srcA = (srcA * modulateA) / 255; |
3048 } | 3333 } |
3049 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { | 3334 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { |
3050 /* This goes away if we ever use premultiplied alpha */ | 3335 /* This goes away if we ever use premultiplied alpha */ |
3051 srcR = (srcR * srcA) / 255; | 3336 if (srcA < 255) { |
3052 srcG = (srcG * srcA) / 255; | 3337 srcR = (srcR * srcA) / 255; |
3053 srcB = (srcB * srcA) / 255; | 3338 srcG = (srcG * srcA) / 255; |
3054 } | 3339 srcB = (srcB * srcA) / 255; |
3055 switch (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | 3340 } |
3341 } | |
3342 switch (flags & (SDL_RENDERCOPY_MASK|SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | |
3343 case SDL_RENDERCOPY_MASK: | |
3344 if (srcA) { | |
3345 dstR = srcR; | |
3346 dstG = srcG; | |
3347 dstB = srcB; | |
3348 } | |
3349 break; | |
3056 case SDL_RENDERCOPY_BLEND: | 3350 case SDL_RENDERCOPY_BLEND: |
3057 dstR = srcR + ((255 - srcA) * dstR) / 255; | 3351 dstR = srcR + ((255 - srcA) * dstR) / 255; |
3058 dstG = srcG + ((255 - srcA) * dstG) / 255; | 3352 dstG = srcG + ((255 - srcA) * dstG) / 255; |
3059 dstB = srcB + ((255 - srcA) * dstB) / 255; | 3353 dstB = srcB + ((255 - srcA) * dstB) / 255; |
3060 break; | 3354 break; |
3166 srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; | 3460 srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; |
3167 dstpixel = *dst; | 3461 dstpixel = *dst; |
3168 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; | 3462 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; |
3169 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { | 3463 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { |
3170 /* This goes away if we ever use premultiplied alpha */ | 3464 /* This goes away if we ever use premultiplied alpha */ |
3171 srcR = (srcR * srcA) / 255; | 3465 if (srcA < 255) { |
3172 srcG = (srcG * srcA) / 255; | 3466 srcR = (srcR * srcA) / 255; |
3173 srcB = (srcB * srcA) / 255; | 3467 srcG = (srcG * srcA) / 255; |
3174 } | 3468 srcB = (srcB * srcA) / 255; |
3175 switch (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | 3469 } |
3470 } | |
3471 switch (flags & (SDL_RENDERCOPY_MASK|SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | |
3472 case SDL_RENDERCOPY_MASK: | |
3473 if (srcA) { | |
3474 dstR = srcR; | |
3475 dstG = srcG; | |
3476 dstB = srcB; | |
3477 } | |
3478 break; | |
3176 case SDL_RENDERCOPY_BLEND: | 3479 case SDL_RENDERCOPY_BLEND: |
3177 dstR = srcR + ((255 - srcA) * dstR) / 255; | 3480 dstR = srcR + ((255 - srcA) * dstR) / 255; |
3178 dstG = srcG + ((255 - srcA) * dstG) / 255; | 3481 dstG = srcG + ((255 - srcA) * dstG) / 255; |
3179 dstB = srcB + ((255 - srcA) * dstB) / 255; | 3482 dstB = srcB + ((255 - srcA) * dstB) / 255; |
3180 break; | 3483 break; |
3238 srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; | 3541 srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; |
3239 dstpixel = *dst; | 3542 dstpixel = *dst; |
3240 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; | 3543 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; |
3241 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { | 3544 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { |
3242 /* This goes away if we ever use premultiplied alpha */ | 3545 /* This goes away if we ever use premultiplied alpha */ |
3243 srcR = (srcR * srcA) / 255; | 3546 if (srcA < 255) { |
3244 srcG = (srcG * srcA) / 255; | 3547 srcR = (srcR * srcA) / 255; |
3245 srcB = (srcB * srcA) / 255; | 3548 srcG = (srcG * srcA) / 255; |
3246 } | 3549 srcB = (srcB * srcA) / 255; |
3247 switch (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | 3550 } |
3551 } | |
3552 switch (flags & (SDL_RENDERCOPY_MASK|SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | |
3553 case SDL_RENDERCOPY_MASK: | |
3554 if (srcA) { | |
3555 dstR = srcR; | |
3556 dstG = srcG; | |
3557 dstB = srcB; | |
3558 } | |
3559 break; | |
3248 case SDL_RENDERCOPY_BLEND: | 3560 case SDL_RENDERCOPY_BLEND: |
3249 dstR = srcR + ((255 - srcA) * dstR) / 255; | 3561 dstR = srcR + ((255 - srcA) * dstR) / 255; |
3250 dstG = srcG + ((255 - srcA) * dstG) / 255; | 3562 dstG = srcG + ((255 - srcA) * dstG) / 255; |
3251 dstB = srcB + ((255 - srcA) * dstB) / 255; | 3563 dstB = srcB + ((255 - srcA) * dstB) / 255; |
3252 break; | 3564 break; |
3291 R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel; | 3603 R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel; |
3292 if (flags & SDL_RENDERCOPY_MODULATE_COLOR) { | 3604 if (flags & SDL_RENDERCOPY_MODULATE_COLOR) { |
3293 R = (R * modulateR) / 255; | 3605 R = (R * modulateR) / 255; |
3294 G = (G * modulateG) / 255; | 3606 G = (G * modulateG) / 255; |
3295 B = (B * modulateB) / 255; | 3607 B = (B * modulateB) / 255; |
3608 } | |
3609 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { | |
3610 A = (A * modulateA) / 255; | |
3296 } | 3611 } |
3297 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; | 3612 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; |
3298 *dst = pixel; | 3613 *dst = pixel; |
3299 ++src; | 3614 ++src; |
3300 ++dst; | 3615 ++dst; |
3346 if (flags & SDL_RENDERCOPY_MODULATE_COLOR) { | 3661 if (flags & SDL_RENDERCOPY_MODULATE_COLOR) { |
3347 R = (R * modulateR) / 255; | 3662 R = (R * modulateR) / 255; |
3348 G = (G * modulateG) / 255; | 3663 G = (G * modulateG) / 255; |
3349 B = (B * modulateB) / 255; | 3664 B = (B * modulateB) / 255; |
3350 } | 3665 } |
3666 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { | |
3667 A = (A * modulateA) / 255; | |
3668 } | |
3351 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; | 3669 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; |
3352 *dst = pixel; | 3670 *dst = pixel; |
3353 posx += incx; | 3671 posx += incx; |
3354 ++dst; | 3672 ++dst; |
3355 } | 3673 } |
3388 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { | 3706 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { |
3389 srcA = (srcA * modulateA) / 255; | 3707 srcA = (srcA * modulateA) / 255; |
3390 } | 3708 } |
3391 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { | 3709 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { |
3392 /* This goes away if we ever use premultiplied alpha */ | 3710 /* This goes away if we ever use premultiplied alpha */ |
3393 srcR = (srcR * srcA) / 255; | 3711 if (srcA < 255) { |
3394 srcG = (srcG * srcA) / 255; | 3712 srcR = (srcR * srcA) / 255; |
3395 srcB = (srcB * srcA) / 255; | 3713 srcG = (srcG * srcA) / 255; |
3396 } | 3714 srcB = (srcB * srcA) / 255; |
3397 switch (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | 3715 } |
3716 } | |
3717 switch (flags & (SDL_RENDERCOPY_MASK|SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | |
3718 case SDL_RENDERCOPY_MASK: | |
3719 if (srcA) { | |
3720 dstR = srcR; | |
3721 dstG = srcG; | |
3722 dstB = srcB; | |
3723 } | |
3724 break; | |
3398 case SDL_RENDERCOPY_BLEND: | 3725 case SDL_RENDERCOPY_BLEND: |
3399 dstR = srcR + ((255 - srcA) * dstR) / 255; | 3726 dstR = srcR + ((255 - srcA) * dstR) / 255; |
3400 dstG = srcG + ((255 - srcA) * dstG) / 255; | 3727 dstG = srcG + ((255 - srcA) * dstG) / 255; |
3401 dstB = srcB + ((255 - srcA) * dstB) / 255; | 3728 dstB = srcB + ((255 - srcA) * dstB) / 255; |
3402 break; | 3729 break; |
3472 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { | 3799 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { |
3473 srcA = (srcA * modulateA) / 255; | 3800 srcA = (srcA * modulateA) / 255; |
3474 } | 3801 } |
3475 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { | 3802 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { |
3476 /* This goes away if we ever use premultiplied alpha */ | 3803 /* This goes away if we ever use premultiplied alpha */ |
3477 srcR = (srcR * srcA) / 255; | 3804 if (srcA < 255) { |
3478 srcG = (srcG * srcA) / 255; | 3805 srcR = (srcR * srcA) / 255; |
3479 srcB = (srcB * srcA) / 255; | 3806 srcG = (srcG * srcA) / 255; |
3480 } | 3807 srcB = (srcB * srcA) / 255; |
3481 switch (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | 3808 } |
3809 } | |
3810 switch (flags & (SDL_RENDERCOPY_MASK|SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | |
3811 case SDL_RENDERCOPY_MASK: | |
3812 if (srcA) { | |
3813 dstR = srcR; | |
3814 dstG = srcG; | |
3815 dstB = srcB; | |
3816 } | |
3817 break; | |
3482 case SDL_RENDERCOPY_BLEND: | 3818 case SDL_RENDERCOPY_BLEND: |
3483 dstR = srcR + ((255 - srcA) * dstR) / 255; | 3819 dstR = srcR + ((255 - srcA) * dstR) / 255; |
3484 dstG = srcG + ((255 - srcA) * dstG) / 255; | 3820 dstG = srcG + ((255 - srcA) * dstG) / 255; |
3485 dstB = srcB + ((255 - srcA) * dstB) / 255; | 3821 dstB = srcB + ((255 - srcA) * dstB) / 255; |
3486 break; | 3822 break; |
3592 srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; | 3928 srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; |
3593 dstpixel = *dst; | 3929 dstpixel = *dst; |
3594 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; | 3930 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; |
3595 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { | 3931 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { |
3596 /* This goes away if we ever use premultiplied alpha */ | 3932 /* This goes away if we ever use premultiplied alpha */ |
3597 srcR = (srcR * srcA) / 255; | 3933 if (srcA < 255) { |
3598 srcG = (srcG * srcA) / 255; | 3934 srcR = (srcR * srcA) / 255; |
3599 srcB = (srcB * srcA) / 255; | 3935 srcG = (srcG * srcA) / 255; |
3600 } | 3936 srcB = (srcB * srcA) / 255; |
3601 switch (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | 3937 } |
3938 } | |
3939 switch (flags & (SDL_RENDERCOPY_MASK|SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | |
3940 case SDL_RENDERCOPY_MASK: | |
3941 if (srcA) { | |
3942 dstR = srcR; | |
3943 dstG = srcG; | |
3944 dstB = srcB; | |
3945 } | |
3946 break; | |
3602 case SDL_RENDERCOPY_BLEND: | 3947 case SDL_RENDERCOPY_BLEND: |
3603 dstR = srcR + ((255 - srcA) * dstR) / 255; | 3948 dstR = srcR + ((255 - srcA) * dstR) / 255; |
3604 dstG = srcG + ((255 - srcA) * dstG) / 255; | 3949 dstG = srcG + ((255 - srcA) * dstG) / 255; |
3605 dstB = srcB + ((255 - srcA) * dstB) / 255; | 3950 dstB = srcB + ((255 - srcA) * dstB) / 255; |
3606 break; | 3951 break; |
3664 srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; | 4009 srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; |
3665 dstpixel = *dst; | 4010 dstpixel = *dst; |
3666 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; | 4011 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; |
3667 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { | 4012 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { |
3668 /* This goes away if we ever use premultiplied alpha */ | 4013 /* This goes away if we ever use premultiplied alpha */ |
3669 srcR = (srcR * srcA) / 255; | 4014 if (srcA < 255) { |
3670 srcG = (srcG * srcA) / 255; | 4015 srcR = (srcR * srcA) / 255; |
3671 srcB = (srcB * srcA) / 255; | 4016 srcG = (srcG * srcA) / 255; |
3672 } | 4017 srcB = (srcB * srcA) / 255; |
3673 switch (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | 4018 } |
4019 } | |
4020 switch (flags & (SDL_RENDERCOPY_MASK|SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | |
4021 case SDL_RENDERCOPY_MASK: | |
4022 if (srcA) { | |
4023 dstR = srcR; | |
4024 dstG = srcG; | |
4025 dstB = srcB; | |
4026 } | |
4027 break; | |
3674 case SDL_RENDERCOPY_BLEND: | 4028 case SDL_RENDERCOPY_BLEND: |
3675 dstR = srcR + ((255 - srcA) * dstR) / 255; | 4029 dstR = srcR + ((255 - srcA) * dstR) / 255; |
3676 dstG = srcG + ((255 - srcA) * dstG) / 255; | 4030 dstG = srcG + ((255 - srcA) * dstG) / 255; |
3677 dstB = srcB + ((255 - srcA) * dstB) / 255; | 4031 dstB = srcB + ((255 - srcA) * dstB) / 255; |
3678 break; | 4032 break; |
3717 A = (Uint8)(pixel >> 24); B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; | 4071 A = (Uint8)(pixel >> 24); B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; |
3718 if (flags & SDL_RENDERCOPY_MODULATE_COLOR) { | 4072 if (flags & SDL_RENDERCOPY_MODULATE_COLOR) { |
3719 R = (R * modulateR) / 255; | 4073 R = (R * modulateR) / 255; |
3720 G = (G * modulateG) / 255; | 4074 G = (G * modulateG) / 255; |
3721 B = (B * modulateB) / 255; | 4075 B = (B * modulateB) / 255; |
4076 } | |
4077 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { | |
4078 A = (A * modulateA) / 255; | |
3722 } | 4079 } |
3723 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; | 4080 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; |
3724 *dst = pixel; | 4081 *dst = pixel; |
3725 ++src; | 4082 ++src; |
3726 ++dst; | 4083 ++dst; |
3772 if (flags & SDL_RENDERCOPY_MODULATE_COLOR) { | 4129 if (flags & SDL_RENDERCOPY_MODULATE_COLOR) { |
3773 R = (R * modulateR) / 255; | 4130 R = (R * modulateR) / 255; |
3774 G = (G * modulateG) / 255; | 4131 G = (G * modulateG) / 255; |
3775 B = (B * modulateB) / 255; | 4132 B = (B * modulateB) / 255; |
3776 } | 4133 } |
4134 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { | |
4135 A = (A * modulateA) / 255; | |
4136 } | |
3777 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; | 4137 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; |
3778 *dst = pixel; | 4138 *dst = pixel; |
3779 posx += incx; | 4139 posx += incx; |
3780 ++dst; | 4140 ++dst; |
3781 } | 4141 } |
3814 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { | 4174 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { |
3815 srcA = (srcA * modulateA) / 255; | 4175 srcA = (srcA * modulateA) / 255; |
3816 } | 4176 } |
3817 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { | 4177 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { |
3818 /* This goes away if we ever use premultiplied alpha */ | 4178 /* This goes away if we ever use premultiplied alpha */ |
3819 srcR = (srcR * srcA) / 255; | 4179 if (srcA < 255) { |
3820 srcG = (srcG * srcA) / 255; | 4180 srcR = (srcR * srcA) / 255; |
3821 srcB = (srcB * srcA) / 255; | 4181 srcG = (srcG * srcA) / 255; |
3822 } | 4182 srcB = (srcB * srcA) / 255; |
3823 switch (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | 4183 } |
4184 } | |
4185 switch (flags & (SDL_RENDERCOPY_MASK|SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | |
4186 case SDL_RENDERCOPY_MASK: | |
4187 if (srcA) { | |
4188 dstR = srcR; | |
4189 dstG = srcG; | |
4190 dstB = srcB; | |
4191 } | |
4192 break; | |
3824 case SDL_RENDERCOPY_BLEND: | 4193 case SDL_RENDERCOPY_BLEND: |
3825 dstR = srcR + ((255 - srcA) * dstR) / 255; | 4194 dstR = srcR + ((255 - srcA) * dstR) / 255; |
3826 dstG = srcG + ((255 - srcA) * dstG) / 255; | 4195 dstG = srcG + ((255 - srcA) * dstG) / 255; |
3827 dstB = srcB + ((255 - srcA) * dstB) / 255; | 4196 dstB = srcB + ((255 - srcA) * dstB) / 255; |
3828 break; | 4197 break; |
3898 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { | 4267 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { |
3899 srcA = (srcA * modulateA) / 255; | 4268 srcA = (srcA * modulateA) / 255; |
3900 } | 4269 } |
3901 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { | 4270 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { |
3902 /* This goes away if we ever use premultiplied alpha */ | 4271 /* This goes away if we ever use premultiplied alpha */ |
3903 srcR = (srcR * srcA) / 255; | 4272 if (srcA < 255) { |
3904 srcG = (srcG * srcA) / 255; | 4273 srcR = (srcR * srcA) / 255; |
3905 srcB = (srcB * srcA) / 255; | 4274 srcG = (srcG * srcA) / 255; |
3906 } | 4275 srcB = (srcB * srcA) / 255; |
3907 switch (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | 4276 } |
4277 } | |
4278 switch (flags & (SDL_RENDERCOPY_MASK|SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | |
4279 case SDL_RENDERCOPY_MASK: | |
4280 if (srcA) { | |
4281 dstR = srcR; | |
4282 dstG = srcG; | |
4283 dstB = srcB; | |
4284 } | |
4285 break; | |
3908 case SDL_RENDERCOPY_BLEND: | 4286 case SDL_RENDERCOPY_BLEND: |
3909 dstR = srcR + ((255 - srcA) * dstR) / 255; | 4287 dstR = srcR + ((255 - srcA) * dstR) / 255; |
3910 dstG = srcG + ((255 - srcA) * dstG) / 255; | 4288 dstG = srcG + ((255 - srcA) * dstG) / 255; |
3911 dstB = srcB + ((255 - srcA) * dstB) / 255; | 4289 dstB = srcB + ((255 - srcA) * dstB) / 255; |
3912 break; | 4290 break; |
4018 srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; | 4396 srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; |
4019 dstpixel = *dst; | 4397 dstpixel = *dst; |
4020 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; | 4398 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; |
4021 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { | 4399 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { |
4022 /* This goes away if we ever use premultiplied alpha */ | 4400 /* This goes away if we ever use premultiplied alpha */ |
4023 srcR = (srcR * srcA) / 255; | 4401 if (srcA < 255) { |
4024 srcG = (srcG * srcA) / 255; | 4402 srcR = (srcR * srcA) / 255; |
4025 srcB = (srcB * srcA) / 255; | 4403 srcG = (srcG * srcA) / 255; |
4026 } | 4404 srcB = (srcB * srcA) / 255; |
4027 switch (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | 4405 } |
4406 } | |
4407 switch (flags & (SDL_RENDERCOPY_MASK|SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | |
4408 case SDL_RENDERCOPY_MASK: | |
4409 if (srcA) { | |
4410 dstR = srcR; | |
4411 dstG = srcG; | |
4412 dstB = srcB; | |
4413 } | |
4414 break; | |
4028 case SDL_RENDERCOPY_BLEND: | 4415 case SDL_RENDERCOPY_BLEND: |
4029 dstR = srcR + ((255 - srcA) * dstR) / 255; | 4416 dstR = srcR + ((255 - srcA) * dstR) / 255; |
4030 dstG = srcG + ((255 - srcA) * dstG) / 255; | 4417 dstG = srcG + ((255 - srcA) * dstG) / 255; |
4031 dstB = srcB + ((255 - srcA) * dstB) / 255; | 4418 dstB = srcB + ((255 - srcA) * dstB) / 255; |
4032 break; | 4419 break; |
4090 srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; | 4477 srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; |
4091 dstpixel = *dst; | 4478 dstpixel = *dst; |
4092 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; | 4479 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; |
4093 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { | 4480 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { |
4094 /* This goes away if we ever use premultiplied alpha */ | 4481 /* This goes away if we ever use premultiplied alpha */ |
4095 srcR = (srcR * srcA) / 255; | 4482 if (srcA < 255) { |
4096 srcG = (srcG * srcA) / 255; | 4483 srcR = (srcR * srcA) / 255; |
4097 srcB = (srcB * srcA) / 255; | 4484 srcG = (srcG * srcA) / 255; |
4098 } | 4485 srcB = (srcB * srcA) / 255; |
4099 switch (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | 4486 } |
4487 } | |
4488 switch (flags & (SDL_RENDERCOPY_MASK|SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | |
4489 case SDL_RENDERCOPY_MASK: | |
4490 if (srcA) { | |
4491 dstR = srcR; | |
4492 dstG = srcG; | |
4493 dstB = srcB; | |
4494 } | |
4495 break; | |
4100 case SDL_RENDERCOPY_BLEND: | 4496 case SDL_RENDERCOPY_BLEND: |
4101 dstR = srcR + ((255 - srcA) * dstR) / 255; | 4497 dstR = srcR + ((255 - srcA) * dstR) / 255; |
4102 dstG = srcG + ((255 - srcA) * dstG) / 255; | 4498 dstG = srcG + ((255 - srcA) * dstG) / 255; |
4103 dstB = srcB + ((255 - srcA) * dstB) / 255; | 4499 dstB = srcB + ((255 - srcA) * dstB) / 255; |
4104 break; | 4500 break; |
4143 A = (Uint8)(pixel >> 24); B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; | 4539 A = (Uint8)(pixel >> 24); B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; |
4144 if (flags & SDL_RENDERCOPY_MODULATE_COLOR) { | 4540 if (flags & SDL_RENDERCOPY_MODULATE_COLOR) { |
4145 R = (R * modulateR) / 255; | 4541 R = (R * modulateR) / 255; |
4146 G = (G * modulateG) / 255; | 4542 G = (G * modulateG) / 255; |
4147 B = (B * modulateB) / 255; | 4543 B = (B * modulateB) / 255; |
4544 } | |
4545 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { | |
4546 A = (A * modulateA) / 255; | |
4148 } | 4547 } |
4149 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; | 4548 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; |
4150 *dst = pixel; | 4549 *dst = pixel; |
4151 ++src; | 4550 ++src; |
4152 ++dst; | 4551 ++dst; |
4198 if (flags & SDL_RENDERCOPY_MODULATE_COLOR) { | 4597 if (flags & SDL_RENDERCOPY_MODULATE_COLOR) { |
4199 R = (R * modulateR) / 255; | 4598 R = (R * modulateR) / 255; |
4200 G = (G * modulateG) / 255; | 4599 G = (G * modulateG) / 255; |
4201 B = (B * modulateB) / 255; | 4600 B = (B * modulateB) / 255; |
4202 } | 4601 } |
4602 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { | |
4603 A = (A * modulateA) / 255; | |
4604 } | |
4203 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; | 4605 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; |
4204 *dst = pixel; | 4606 *dst = pixel; |
4205 posx += incx; | 4607 posx += incx; |
4206 ++dst; | 4608 ++dst; |
4207 } | 4609 } |
4240 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { | 4642 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { |
4241 srcA = (srcA * modulateA) / 255; | 4643 srcA = (srcA * modulateA) / 255; |
4242 } | 4644 } |
4243 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { | 4645 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { |
4244 /* This goes away if we ever use premultiplied alpha */ | 4646 /* This goes away if we ever use premultiplied alpha */ |
4245 srcR = (srcR * srcA) / 255; | 4647 if (srcA < 255) { |
4246 srcG = (srcG * srcA) / 255; | 4648 srcR = (srcR * srcA) / 255; |
4247 srcB = (srcB * srcA) / 255; | 4649 srcG = (srcG * srcA) / 255; |
4248 } | 4650 srcB = (srcB * srcA) / 255; |
4249 switch (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | 4651 } |
4652 } | |
4653 switch (flags & (SDL_RENDERCOPY_MASK|SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | |
4654 case SDL_RENDERCOPY_MASK: | |
4655 if (srcA) { | |
4656 dstR = srcR; | |
4657 dstG = srcG; | |
4658 dstB = srcB; | |
4659 } | |
4660 break; | |
4250 case SDL_RENDERCOPY_BLEND: | 4661 case SDL_RENDERCOPY_BLEND: |
4251 dstR = srcR + ((255 - srcA) * dstR) / 255; | 4662 dstR = srcR + ((255 - srcA) * dstR) / 255; |
4252 dstG = srcG + ((255 - srcA) * dstG) / 255; | 4663 dstG = srcG + ((255 - srcA) * dstG) / 255; |
4253 dstB = srcB + ((255 - srcA) * dstB) / 255; | 4664 dstB = srcB + ((255 - srcA) * dstB) / 255; |
4254 break; | 4665 break; |
4324 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { | 4735 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { |
4325 srcA = (srcA * modulateA) / 255; | 4736 srcA = (srcA * modulateA) / 255; |
4326 } | 4737 } |
4327 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { | 4738 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { |
4328 /* This goes away if we ever use premultiplied alpha */ | 4739 /* This goes away if we ever use premultiplied alpha */ |
4329 srcR = (srcR * srcA) / 255; | 4740 if (srcA < 255) { |
4330 srcG = (srcG * srcA) / 255; | 4741 srcR = (srcR * srcA) / 255; |
4331 srcB = (srcB * srcA) / 255; | 4742 srcG = (srcG * srcA) / 255; |
4332 } | 4743 srcB = (srcB * srcA) / 255; |
4333 switch (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | 4744 } |
4745 } | |
4746 switch (flags & (SDL_RENDERCOPY_MASK|SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | |
4747 case SDL_RENDERCOPY_MASK: | |
4748 if (srcA) { | |
4749 dstR = srcR; | |
4750 dstG = srcG; | |
4751 dstB = srcB; | |
4752 } | |
4753 break; | |
4334 case SDL_RENDERCOPY_BLEND: | 4754 case SDL_RENDERCOPY_BLEND: |
4335 dstR = srcR + ((255 - srcA) * dstR) / 255; | 4755 dstR = srcR + ((255 - srcA) * dstR) / 255; |
4336 dstG = srcG + ((255 - srcA) * dstG) / 255; | 4756 dstG = srcG + ((255 - srcA) * dstG) / 255; |
4337 dstB = srcB + ((255 - srcA) * dstB) / 255; | 4757 dstB = srcB + ((255 - srcA) * dstB) / 255; |
4338 break; | 4758 break; |
4444 srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; | 4864 srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; |
4445 dstpixel = *dst; | 4865 dstpixel = *dst; |
4446 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; | 4866 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; |
4447 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { | 4867 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { |
4448 /* This goes away if we ever use premultiplied alpha */ | 4868 /* This goes away if we ever use premultiplied alpha */ |
4449 srcR = (srcR * srcA) / 255; | 4869 if (srcA < 255) { |
4450 srcG = (srcG * srcA) / 255; | 4870 srcR = (srcR * srcA) / 255; |
4451 srcB = (srcB * srcA) / 255; | 4871 srcG = (srcG * srcA) / 255; |
4452 } | 4872 srcB = (srcB * srcA) / 255; |
4453 switch (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | 4873 } |
4874 } | |
4875 switch (flags & (SDL_RENDERCOPY_MASK|SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | |
4876 case SDL_RENDERCOPY_MASK: | |
4877 if (srcA) { | |
4878 dstR = srcR; | |
4879 dstG = srcG; | |
4880 dstB = srcB; | |
4881 } | |
4882 break; | |
4454 case SDL_RENDERCOPY_BLEND: | 4883 case SDL_RENDERCOPY_BLEND: |
4455 dstR = srcR + ((255 - srcA) * dstR) / 255; | 4884 dstR = srcR + ((255 - srcA) * dstR) / 255; |
4456 dstG = srcG + ((255 - srcA) * dstG) / 255; | 4885 dstG = srcG + ((255 - srcA) * dstG) / 255; |
4457 dstB = srcB + ((255 - srcA) * dstB) / 255; | 4886 dstB = srcB + ((255 - srcA) * dstB) / 255; |
4458 break; | 4887 break; |
4516 srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; | 4945 srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; |
4517 dstpixel = *dst; | 4946 dstpixel = *dst; |
4518 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; | 4947 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; |
4519 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { | 4948 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { |
4520 /* This goes away if we ever use premultiplied alpha */ | 4949 /* This goes away if we ever use premultiplied alpha */ |
4521 srcR = (srcR * srcA) / 255; | 4950 if (srcA < 255) { |
4522 srcG = (srcG * srcA) / 255; | 4951 srcR = (srcR * srcA) / 255; |
4523 srcB = (srcB * srcA) / 255; | 4952 srcG = (srcG * srcA) / 255; |
4524 } | 4953 srcB = (srcB * srcA) / 255; |
4525 switch (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | 4954 } |
4955 } | |
4956 switch (flags & (SDL_RENDERCOPY_MASK|SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | |
4957 case SDL_RENDERCOPY_MASK: | |
4958 if (srcA) { | |
4959 dstR = srcR; | |
4960 dstG = srcG; | |
4961 dstB = srcB; | |
4962 } | |
4963 break; | |
4526 case SDL_RENDERCOPY_BLEND: | 4964 case SDL_RENDERCOPY_BLEND: |
4527 dstR = srcR + ((255 - srcA) * dstR) / 255; | 4965 dstR = srcR + ((255 - srcA) * dstR) / 255; |
4528 dstG = srcG + ((255 - srcA) * dstG) / 255; | 4966 dstG = srcG + ((255 - srcA) * dstG) / 255; |
4529 dstB = srcB + ((255 - srcA) * dstB) / 255; | 4967 dstB = srcB + ((255 - srcA) * dstB) / 255; |
4530 break; | 4968 break; |
4569 B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); A = (Uint8)pixel; | 5007 B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); A = (Uint8)pixel; |
4570 if (flags & SDL_RENDERCOPY_MODULATE_COLOR) { | 5008 if (flags & SDL_RENDERCOPY_MODULATE_COLOR) { |
4571 R = (R * modulateR) / 255; | 5009 R = (R * modulateR) / 255; |
4572 G = (G * modulateG) / 255; | 5010 G = (G * modulateG) / 255; |
4573 B = (B * modulateB) / 255; | 5011 B = (B * modulateB) / 255; |
5012 } | |
5013 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { | |
5014 A = (A * modulateA) / 255; | |
4574 } | 5015 } |
4575 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; | 5016 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; |
4576 *dst = pixel; | 5017 *dst = pixel; |
4577 ++src; | 5018 ++src; |
4578 ++dst; | 5019 ++dst; |
4624 if (flags & SDL_RENDERCOPY_MODULATE_COLOR) { | 5065 if (flags & SDL_RENDERCOPY_MODULATE_COLOR) { |
4625 R = (R * modulateR) / 255; | 5066 R = (R * modulateR) / 255; |
4626 G = (G * modulateG) / 255; | 5067 G = (G * modulateG) / 255; |
4627 B = (B * modulateB) / 255; | 5068 B = (B * modulateB) / 255; |
4628 } | 5069 } |
5070 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { | |
5071 A = (A * modulateA) / 255; | |
5072 } | |
4629 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; | 5073 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; |
4630 *dst = pixel; | 5074 *dst = pixel; |
4631 posx += incx; | 5075 posx += incx; |
4632 ++dst; | 5076 ++dst; |
4633 } | 5077 } |
4666 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { | 5110 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { |
4667 srcA = (srcA * modulateA) / 255; | 5111 srcA = (srcA * modulateA) / 255; |
4668 } | 5112 } |
4669 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { | 5113 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { |
4670 /* This goes away if we ever use premultiplied alpha */ | 5114 /* This goes away if we ever use premultiplied alpha */ |
4671 srcR = (srcR * srcA) / 255; | 5115 if (srcA < 255) { |
4672 srcG = (srcG * srcA) / 255; | 5116 srcR = (srcR * srcA) / 255; |
4673 srcB = (srcB * srcA) / 255; | 5117 srcG = (srcG * srcA) / 255; |
4674 } | 5118 srcB = (srcB * srcA) / 255; |
4675 switch (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | 5119 } |
5120 } | |
5121 switch (flags & (SDL_RENDERCOPY_MASK|SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | |
5122 case SDL_RENDERCOPY_MASK: | |
5123 if (srcA) { | |
5124 dstR = srcR; | |
5125 dstG = srcG; | |
5126 dstB = srcB; | |
5127 } | |
5128 break; | |
4676 case SDL_RENDERCOPY_BLEND: | 5129 case SDL_RENDERCOPY_BLEND: |
4677 dstR = srcR + ((255 - srcA) * dstR) / 255; | 5130 dstR = srcR + ((255 - srcA) * dstR) / 255; |
4678 dstG = srcG + ((255 - srcA) * dstG) / 255; | 5131 dstG = srcG + ((255 - srcA) * dstG) / 255; |
4679 dstB = srcB + ((255 - srcA) * dstB) / 255; | 5132 dstB = srcB + ((255 - srcA) * dstB) / 255; |
4680 break; | 5133 break; |
4750 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { | 5203 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { |
4751 srcA = (srcA * modulateA) / 255; | 5204 srcA = (srcA * modulateA) / 255; |
4752 } | 5205 } |
4753 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { | 5206 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { |
4754 /* This goes away if we ever use premultiplied alpha */ | 5207 /* This goes away if we ever use premultiplied alpha */ |
4755 srcR = (srcR * srcA) / 255; | 5208 if (srcA < 255) { |
4756 srcG = (srcG * srcA) / 255; | 5209 srcR = (srcR * srcA) / 255; |
4757 srcB = (srcB * srcA) / 255; | 5210 srcG = (srcG * srcA) / 255; |
4758 } | 5211 srcB = (srcB * srcA) / 255; |
4759 switch (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | 5212 } |
5213 } | |
5214 switch (flags & (SDL_RENDERCOPY_MASK|SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | |
5215 case SDL_RENDERCOPY_MASK: | |
5216 if (srcA) { | |
5217 dstR = srcR; | |
5218 dstG = srcG; | |
5219 dstB = srcB; | |
5220 } | |
5221 break; | |
4760 case SDL_RENDERCOPY_BLEND: | 5222 case SDL_RENDERCOPY_BLEND: |
4761 dstR = srcR + ((255 - srcA) * dstR) / 255; | 5223 dstR = srcR + ((255 - srcA) * dstR) / 255; |
4762 dstG = srcG + ((255 - srcA) * dstG) / 255; | 5224 dstG = srcG + ((255 - srcA) * dstG) / 255; |
4763 dstB = srcB + ((255 - srcA) * dstB) / 255; | 5225 dstB = srcB + ((255 - srcA) * dstB) / 255; |
4764 break; | 5226 break; |
4870 srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; | 5332 srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; |
4871 dstpixel = *dst; | 5333 dstpixel = *dst; |
4872 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; | 5334 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; |
4873 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { | 5335 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { |
4874 /* This goes away if we ever use premultiplied alpha */ | 5336 /* This goes away if we ever use premultiplied alpha */ |
4875 srcR = (srcR * srcA) / 255; | 5337 if (srcA < 255) { |
4876 srcG = (srcG * srcA) / 255; | 5338 srcR = (srcR * srcA) / 255; |
4877 srcB = (srcB * srcA) / 255; | 5339 srcG = (srcG * srcA) / 255; |
4878 } | 5340 srcB = (srcB * srcA) / 255; |
4879 switch (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | 5341 } |
5342 } | |
5343 switch (flags & (SDL_RENDERCOPY_MASK|SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | |
5344 case SDL_RENDERCOPY_MASK: | |
5345 if (srcA) { | |
5346 dstR = srcR; | |
5347 dstG = srcG; | |
5348 dstB = srcB; | |
5349 } | |
5350 break; | |
4880 case SDL_RENDERCOPY_BLEND: | 5351 case SDL_RENDERCOPY_BLEND: |
4881 dstR = srcR + ((255 - srcA) * dstR) / 255; | 5352 dstR = srcR + ((255 - srcA) * dstR) / 255; |
4882 dstG = srcG + ((255 - srcA) * dstG) / 255; | 5353 dstG = srcG + ((255 - srcA) * dstG) / 255; |
4883 dstB = srcB + ((255 - srcA) * dstB) / 255; | 5354 dstB = srcB + ((255 - srcA) * dstB) / 255; |
4884 break; | 5355 break; |
4942 srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; | 5413 srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; |
4943 dstpixel = *dst; | 5414 dstpixel = *dst; |
4944 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; | 5415 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; |
4945 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { | 5416 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { |
4946 /* This goes away if we ever use premultiplied alpha */ | 5417 /* This goes away if we ever use premultiplied alpha */ |
4947 srcR = (srcR * srcA) / 255; | 5418 if (srcA < 255) { |
4948 srcG = (srcG * srcA) / 255; | 5419 srcR = (srcR * srcA) / 255; |
4949 srcB = (srcB * srcA) / 255; | 5420 srcG = (srcG * srcA) / 255; |
4950 } | 5421 srcB = (srcB * srcA) / 255; |
4951 switch (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | 5422 } |
5423 } | |
5424 switch (flags & (SDL_RENDERCOPY_MASK|SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | |
5425 case SDL_RENDERCOPY_MASK: | |
5426 if (srcA) { | |
5427 dstR = srcR; | |
5428 dstG = srcG; | |
5429 dstB = srcB; | |
5430 } | |
5431 break; | |
4952 case SDL_RENDERCOPY_BLEND: | 5432 case SDL_RENDERCOPY_BLEND: |
4953 dstR = srcR + ((255 - srcA) * dstR) / 255; | 5433 dstR = srcR + ((255 - srcA) * dstR) / 255; |
4954 dstG = srcG + ((255 - srcA) * dstG) / 255; | 5434 dstG = srcG + ((255 - srcA) * dstG) / 255; |
4955 dstB = srcB + ((255 - srcA) * dstB) / 255; | 5435 dstB = srcB + ((255 - srcA) * dstB) / 255; |
4956 break; | 5436 break; |
4995 B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); A = (Uint8)pixel; | 5475 B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); A = (Uint8)pixel; |
4996 if (flags & SDL_RENDERCOPY_MODULATE_COLOR) { | 5476 if (flags & SDL_RENDERCOPY_MODULATE_COLOR) { |
4997 R = (R * modulateR) / 255; | 5477 R = (R * modulateR) / 255; |
4998 G = (G * modulateG) / 255; | 5478 G = (G * modulateG) / 255; |
4999 B = (B * modulateB) / 255; | 5479 B = (B * modulateB) / 255; |
5480 } | |
5481 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { | |
5482 A = (A * modulateA) / 255; | |
5000 } | 5483 } |
5001 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; | 5484 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; |
5002 *dst = pixel; | 5485 *dst = pixel; |
5003 ++src; | 5486 ++src; |
5004 ++dst; | 5487 ++dst; |
5050 if (flags & SDL_RENDERCOPY_MODULATE_COLOR) { | 5533 if (flags & SDL_RENDERCOPY_MODULATE_COLOR) { |
5051 R = (R * modulateR) / 255; | 5534 R = (R * modulateR) / 255; |
5052 G = (G * modulateG) / 255; | 5535 G = (G * modulateG) / 255; |
5053 B = (B * modulateB) / 255; | 5536 B = (B * modulateB) / 255; |
5054 } | 5537 } |
5538 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { | |
5539 A = (A * modulateA) / 255; | |
5540 } | |
5055 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; | 5541 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; |
5056 *dst = pixel; | 5542 *dst = pixel; |
5057 posx += incx; | 5543 posx += incx; |
5058 ++dst; | 5544 ++dst; |
5059 } | 5545 } |
5092 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { | 5578 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { |
5093 srcA = (srcA * modulateA) / 255; | 5579 srcA = (srcA * modulateA) / 255; |
5094 } | 5580 } |
5095 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { | 5581 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { |
5096 /* This goes away if we ever use premultiplied alpha */ | 5582 /* This goes away if we ever use premultiplied alpha */ |
5097 srcR = (srcR * srcA) / 255; | 5583 if (srcA < 255) { |
5098 srcG = (srcG * srcA) / 255; | 5584 srcR = (srcR * srcA) / 255; |
5099 srcB = (srcB * srcA) / 255; | 5585 srcG = (srcG * srcA) / 255; |
5100 } | 5586 srcB = (srcB * srcA) / 255; |
5101 switch (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | 5587 } |
5588 } | |
5589 switch (flags & (SDL_RENDERCOPY_MASK|SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | |
5590 case SDL_RENDERCOPY_MASK: | |
5591 if (srcA) { | |
5592 dstR = srcR; | |
5593 dstG = srcG; | |
5594 dstB = srcB; | |
5595 } | |
5596 break; | |
5102 case SDL_RENDERCOPY_BLEND: | 5597 case SDL_RENDERCOPY_BLEND: |
5103 dstR = srcR + ((255 - srcA) * dstR) / 255; | 5598 dstR = srcR + ((255 - srcA) * dstR) / 255; |
5104 dstG = srcG + ((255 - srcA) * dstG) / 255; | 5599 dstG = srcG + ((255 - srcA) * dstG) / 255; |
5105 dstB = srcB + ((255 - srcA) * dstB) / 255; | 5600 dstB = srcB + ((255 - srcA) * dstB) / 255; |
5106 break; | 5601 break; |
5176 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { | 5671 if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) { |
5177 srcA = (srcA * modulateA) / 255; | 5672 srcA = (srcA * modulateA) / 255; |
5178 } | 5673 } |
5179 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { | 5674 if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) { |
5180 /* This goes away if we ever use premultiplied alpha */ | 5675 /* This goes away if we ever use premultiplied alpha */ |
5181 srcR = (srcR * srcA) / 255; | 5676 if (srcA < 255) { |
5182 srcG = (srcG * srcA) / 255; | 5677 srcR = (srcR * srcA) / 255; |
5183 srcB = (srcB * srcA) / 255; | 5678 srcG = (srcG * srcA) / 255; |
5184 } | 5679 srcB = (srcB * srcA) / 255; |
5185 switch (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | 5680 } |
5681 } | |
5682 switch (flags & (SDL_RENDERCOPY_MASK|SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) { | |
5683 case SDL_RENDERCOPY_MASK: | |
5684 if (srcA) { | |
5685 dstR = srcR; | |
5686 dstG = srcG; | |
5687 dstB = srcB; | |
5688 } | |
5689 break; | |
5186 case SDL_RENDERCOPY_BLEND: | 5690 case SDL_RENDERCOPY_BLEND: |
5187 dstR = srcR + ((255 - srcA) * dstR) / 255; | 5691 dstR = srcR + ((255 - srcA) * dstR) / 255; |
5188 dstG = srcG + ((255 - srcA) * dstG) / 255; | 5692 dstG = srcG + ((255 - srcA) * dstG) / 255; |
5189 dstB = srcB + ((255 - srcA) * dstB) / 255; | 5693 dstB = srcB + ((255 - srcA) * dstB) / 255; |
5190 break; | 5694 break; |