1 /* DO NOT EDIT! This file is generated by sdlgenblit.pl */
3 Simple DirectMedia Layer
4 Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
6 This software is provided 'as-is', without any express or implied
7 warranty. In no event will the authors be held liable for any damages
8 arising from the use of this software.
10 Permission is granted to anyone to use this software for any purpose,
11 including commercial applications, and to alter it and redistribute it
12 freely, subject to the following restrictions:
14 1. The origin of this software must not be misrepresented; you must not
15 claim that you wrote the original software. If you use this software
16 in a product, an acknowledgment in the product documentation would be
17 appreciated but is not required.
18 2. Altered source versions must be plainly marked as such, and must not be
19 misrepresented as being the original software.
20 3. This notice may not be removed or altered from any source distribution.
22 #include "../SDL_internal.h"
24 #if SDL_HAVE_BLIT_AUTO
28 #include "SDL_video.h"
30 #include "SDL_blit_auto.h"
32 static void SDL_Blit_RGB888_RGB888_Scale(SDL_BlitInfo *info)
40 incy = (info->src_h << 16) / info->dst_h;
41 incx = (info->src_w << 16) / info->dst_w;
43 while (info->dst_h--) {
45 Uint32 *dst = (Uint32 *)info->dst;
49 while (posy >= 0x10000L) {
54 if (posx >= 0x10000L) {
55 while (posx >= 0x10000L) {
59 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
66 info->dst += info->dst_pitch;
70 static void SDL_Blit_RGB888_RGB888_Blend(SDL_BlitInfo *info)
72 const int flags = info->flags;
74 Uint32 srcR, srcG, srcB;
76 Uint32 dstR, dstG, dstB;
78 while (info->dst_h--) {
79 Uint32 *src = (Uint32 *)info->src;
80 Uint32 *dst = (Uint32 *)info->dst;
84 srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel;
86 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
87 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
94 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
95 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
96 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
99 dstR = (srcR * dstR) / 255;
100 dstG = (srcG * dstG) / 255;
101 dstB = (srcB * dstB) / 255;
104 dstR = (srcR * dstR) / 255;
105 dstG = (srcG * dstG) / 255;
106 dstB = (srcB * dstB) / 255;
109 dstpixel = (dstR << 16) | (dstG << 8) | dstB;
114 info->src += info->src_pitch;
115 info->dst += info->dst_pitch;
119 static void SDL_Blit_RGB888_RGB888_Blend_Scale(SDL_BlitInfo *info)
121 const int flags = info->flags;
123 Uint32 srcR, srcG, srcB;
125 Uint32 dstR, dstG, dstB;
132 incy = (info->src_h << 16) / info->dst_h;
133 incx = (info->src_w << 16) / info->dst_w;
135 while (info->dst_h--) {
137 Uint32 *dst = (Uint32 *)info->dst;
141 while (posy >= 0x10000L) {
146 if (posx >= 0x10000L) {
147 while (posx >= 0x10000L) {
151 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
154 srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel;
156 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
157 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
164 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
165 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
166 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
169 dstR = (srcR * dstR) / 255;
170 dstG = (srcG * dstG) / 255;
171 dstB = (srcB * dstB) / 255;
174 dstR = (srcR * dstR) / 255;
175 dstG = (srcG * dstG) / 255;
176 dstB = (srcB * dstB) / 255;
179 dstpixel = (dstR << 16) | (dstG << 8) | dstB;
185 info->dst += info->dst_pitch;
189 static void SDL_Blit_RGB888_RGB888_Modulate(SDL_BlitInfo *info)
191 const int flags = info->flags;
192 const Uint32 modulateR = info->r;
193 const Uint32 modulateG = info->g;
194 const Uint32 modulateB = info->b;
198 while (info->dst_h--) {
199 Uint32 *src = (Uint32 *)info->src;
200 Uint32 *dst = (Uint32 *)info->dst;
204 R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
205 if (flags & SDL_COPY_MODULATE_COLOR) {
206 R = (R * modulateR) / 255;
207 G = (G * modulateG) / 255;
208 B = (B * modulateB) / 255;
210 pixel = (R << 16) | (G << 8) | B;
215 info->src += info->src_pitch;
216 info->dst += info->dst_pitch;
220 static void SDL_Blit_RGB888_RGB888_Modulate_Scale(SDL_BlitInfo *info)
222 const int flags = info->flags;
223 const Uint32 modulateR = info->r;
224 const Uint32 modulateG = info->g;
225 const Uint32 modulateB = info->b;
234 incy = (info->src_h << 16) / info->dst_h;
235 incx = (info->src_w << 16) / info->dst_w;
237 while (info->dst_h--) {
239 Uint32 *dst = (Uint32 *)info->dst;
243 while (posy >= 0x10000L) {
248 if (posx >= 0x10000L) {
249 while (posx >= 0x10000L) {
253 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
256 R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
257 if (flags & SDL_COPY_MODULATE_COLOR) {
258 R = (R * modulateR) / 255;
259 G = (G * modulateG) / 255;
260 B = (B * modulateB) / 255;
262 pixel = (R << 16) | (G << 8) | B;
268 info->dst += info->dst_pitch;
272 static void SDL_Blit_RGB888_RGB888_Modulate_Blend(SDL_BlitInfo *info)
274 const int flags = info->flags;
275 const Uint32 modulateR = info->r;
276 const Uint32 modulateG = info->g;
277 const Uint32 modulateB = info->b;
278 const Uint32 modulateA = info->a;
280 const Uint32 srcA = (flags & SDL_COPY_MODULATE_ALPHA) ? modulateA : 0xFF;
281 Uint32 srcR, srcG, srcB;
283 Uint32 dstR, dstG, dstB;
285 while (info->dst_h--) {
286 Uint32 *src = (Uint32 *)info->src;
287 Uint32 *dst = (Uint32 *)info->dst;
291 srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel;
293 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
294 if (flags & SDL_COPY_MODULATE_COLOR) {
295 srcR = (srcR * modulateR) / 255;
296 srcG = (srcG * modulateG) / 255;
297 srcB = (srcB * modulateB) / 255;
299 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
300 /* This goes away if we ever use premultiplied alpha */
302 srcR = (srcR * srcA) / 255;
303 srcG = (srcG * srcA) / 255;
304 srcB = (srcB * srcA) / 255;
307 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
309 dstR = srcR + ((255 - srcA) * dstR) / 255;
310 dstG = srcG + ((255 - srcA) * dstG) / 255;
311 dstB = srcB + ((255 - srcA) * dstB) / 255;
314 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
315 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
316 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
319 dstR = (srcR * dstR) / 255;
320 dstG = (srcG * dstG) / 255;
321 dstB = (srcB * dstB) / 255;
324 dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
325 dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
326 dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
329 dstpixel = (dstR << 16) | (dstG << 8) | dstB;
334 info->src += info->src_pitch;
335 info->dst += info->dst_pitch;
339 static void SDL_Blit_RGB888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info)
341 const int flags = info->flags;
342 const Uint32 modulateR = info->r;
343 const Uint32 modulateG = info->g;
344 const Uint32 modulateB = info->b;
345 const Uint32 modulateA = info->a;
347 const Uint32 srcA = (flags & SDL_COPY_MODULATE_ALPHA) ? modulateA : 0xFF;
348 Uint32 srcR, srcG, srcB;
350 Uint32 dstR, dstG, dstB;
357 incy = (info->src_h << 16) / info->dst_h;
358 incx = (info->src_w << 16) / info->dst_w;
360 while (info->dst_h--) {
362 Uint32 *dst = (Uint32 *)info->dst;
366 while (posy >= 0x10000L) {
371 if (posx >= 0x10000L) {
372 while (posx >= 0x10000L) {
376 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
379 srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel;
381 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
382 if (flags & SDL_COPY_MODULATE_COLOR) {
383 srcR = (srcR * modulateR) / 255;
384 srcG = (srcG * modulateG) / 255;
385 srcB = (srcB * modulateB) / 255;
387 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
388 /* This goes away if we ever use premultiplied alpha */
390 srcR = (srcR * srcA) / 255;
391 srcG = (srcG * srcA) / 255;
392 srcB = (srcB * srcA) / 255;
395 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
397 dstR = srcR + ((255 - srcA) * dstR) / 255;
398 dstG = srcG + ((255 - srcA) * dstG) / 255;
399 dstB = srcB + ((255 - srcA) * dstB) / 255;
402 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
403 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
404 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
407 dstR = (srcR * dstR) / 255;
408 dstG = (srcG * dstG) / 255;
409 dstB = (srcB * dstB) / 255;
412 dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
413 dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
414 dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
417 dstpixel = (dstR << 16) | (dstG << 8) | dstB;
423 info->dst += info->dst_pitch;
427 static void SDL_Blit_RGB888_BGR888_Scale(SDL_BlitInfo *info)
437 incy = (info->src_h << 16) / info->dst_h;
438 incx = (info->src_w << 16) / info->dst_w;
440 while (info->dst_h--) {
442 Uint32 *dst = (Uint32 *)info->dst;
446 while (posy >= 0x10000L) {
451 if (posx >= 0x10000L) {
452 while (posx >= 0x10000L) {
456 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
459 R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
460 pixel = (B << 16) | (G << 8) | R;
466 info->dst += info->dst_pitch;
470 static void SDL_Blit_RGB888_BGR888_Blend(SDL_BlitInfo *info)
472 const int flags = info->flags;
474 Uint32 srcR, srcG, srcB;
476 Uint32 dstR, dstG, dstB;
478 while (info->dst_h--) {
479 Uint32 *src = (Uint32 *)info->src;
480 Uint32 *dst = (Uint32 *)info->dst;
484 srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel;
486 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel;
487 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
494 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
495 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
496 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
499 dstR = (srcR * dstR) / 255;
500 dstG = (srcG * dstG) / 255;
501 dstB = (srcB * dstB) / 255;
504 dstR = (srcR * dstR) / 255;
505 dstG = (srcG * dstG) / 255;
506 dstB = (srcB * dstB) / 255;
509 dstpixel = (dstB << 16) | (dstG << 8) | dstR;
514 info->src += info->src_pitch;
515 info->dst += info->dst_pitch;
519 static void SDL_Blit_RGB888_BGR888_Blend_Scale(SDL_BlitInfo *info)
521 const int flags = info->flags;
523 Uint32 srcR, srcG, srcB;
525 Uint32 dstR, dstG, dstB;
532 incy = (info->src_h << 16) / info->dst_h;
533 incx = (info->src_w << 16) / info->dst_w;
535 while (info->dst_h--) {
537 Uint32 *dst = (Uint32 *)info->dst;
541 while (posy >= 0x10000L) {
546 if (posx >= 0x10000L) {
547 while (posx >= 0x10000L) {
551 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
554 srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel;
556 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel;
557 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
564 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
565 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
566 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
569 dstR = (srcR * dstR) / 255;
570 dstG = (srcG * dstG) / 255;
571 dstB = (srcB * dstB) / 255;
574 dstR = (srcR * dstR) / 255;
575 dstG = (srcG * dstG) / 255;
576 dstB = (srcB * dstB) / 255;
579 dstpixel = (dstB << 16) | (dstG << 8) | dstR;
585 info->dst += info->dst_pitch;
589 static void SDL_Blit_RGB888_BGR888_Modulate(SDL_BlitInfo *info)
591 const int flags = info->flags;
592 const Uint32 modulateR = info->r;
593 const Uint32 modulateG = info->g;
594 const Uint32 modulateB = info->b;
598 while (info->dst_h--) {
599 Uint32 *src = (Uint32 *)info->src;
600 Uint32 *dst = (Uint32 *)info->dst;
604 R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
605 if (flags & SDL_COPY_MODULATE_COLOR) {
606 R = (R * modulateR) / 255;
607 G = (G * modulateG) / 255;
608 B = (B * modulateB) / 255;
610 pixel = (B << 16) | (G << 8) | R;
615 info->src += info->src_pitch;
616 info->dst += info->dst_pitch;
620 static void SDL_Blit_RGB888_BGR888_Modulate_Scale(SDL_BlitInfo *info)
622 const int flags = info->flags;
623 const Uint32 modulateR = info->r;
624 const Uint32 modulateG = info->g;
625 const Uint32 modulateB = info->b;
634 incy = (info->src_h << 16) / info->dst_h;
635 incx = (info->src_w << 16) / info->dst_w;
637 while (info->dst_h--) {
639 Uint32 *dst = (Uint32 *)info->dst;
643 while (posy >= 0x10000L) {
648 if (posx >= 0x10000L) {
649 while (posx >= 0x10000L) {
653 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
656 R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
657 if (flags & SDL_COPY_MODULATE_COLOR) {
658 R = (R * modulateR) / 255;
659 G = (G * modulateG) / 255;
660 B = (B * modulateB) / 255;
662 pixel = (B << 16) | (G << 8) | R;
668 info->dst += info->dst_pitch;
672 static void SDL_Blit_RGB888_BGR888_Modulate_Blend(SDL_BlitInfo *info)
674 const int flags = info->flags;
675 const Uint32 modulateR = info->r;
676 const Uint32 modulateG = info->g;
677 const Uint32 modulateB = info->b;
678 const Uint32 modulateA = info->a;
680 const Uint32 srcA = (flags & SDL_COPY_MODULATE_ALPHA) ? modulateA : 0xFF;
681 Uint32 srcR, srcG, srcB;
683 Uint32 dstR, dstG, dstB;
685 while (info->dst_h--) {
686 Uint32 *src = (Uint32 *)info->src;
687 Uint32 *dst = (Uint32 *)info->dst;
691 srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel;
693 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel;
694 if (flags & SDL_COPY_MODULATE_COLOR) {
695 srcR = (srcR * modulateR) / 255;
696 srcG = (srcG * modulateG) / 255;
697 srcB = (srcB * modulateB) / 255;
699 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
700 /* This goes away if we ever use premultiplied alpha */
702 srcR = (srcR * srcA) / 255;
703 srcG = (srcG * srcA) / 255;
704 srcB = (srcB * srcA) / 255;
707 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
709 dstR = srcR + ((255 - srcA) * dstR) / 255;
710 dstG = srcG + ((255 - srcA) * dstG) / 255;
711 dstB = srcB + ((255 - srcA) * dstB) / 255;
714 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
715 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
716 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
719 dstR = (srcR * dstR) / 255;
720 dstG = (srcG * dstG) / 255;
721 dstB = (srcB * dstB) / 255;
724 dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
725 dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
726 dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
729 dstpixel = (dstB << 16) | (dstG << 8) | dstR;
734 info->src += info->src_pitch;
735 info->dst += info->dst_pitch;
739 static void SDL_Blit_RGB888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info)
741 const int flags = info->flags;
742 const Uint32 modulateR = info->r;
743 const Uint32 modulateG = info->g;
744 const Uint32 modulateB = info->b;
745 const Uint32 modulateA = info->a;
747 const Uint32 srcA = (flags & SDL_COPY_MODULATE_ALPHA) ? modulateA : 0xFF;
748 Uint32 srcR, srcG, srcB;
750 Uint32 dstR, dstG, dstB;
757 incy = (info->src_h << 16) / info->dst_h;
758 incx = (info->src_w << 16) / info->dst_w;
760 while (info->dst_h--) {
762 Uint32 *dst = (Uint32 *)info->dst;
766 while (posy >= 0x10000L) {
771 if (posx >= 0x10000L) {
772 while (posx >= 0x10000L) {
776 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
779 srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel;
781 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel;
782 if (flags & SDL_COPY_MODULATE_COLOR) {
783 srcR = (srcR * modulateR) / 255;
784 srcG = (srcG * modulateG) / 255;
785 srcB = (srcB * modulateB) / 255;
787 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
788 /* This goes away if we ever use premultiplied alpha */
790 srcR = (srcR * srcA) / 255;
791 srcG = (srcG * srcA) / 255;
792 srcB = (srcB * srcA) / 255;
795 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
797 dstR = srcR + ((255 - srcA) * dstR) / 255;
798 dstG = srcG + ((255 - srcA) * dstG) / 255;
799 dstB = srcB + ((255 - srcA) * dstB) / 255;
802 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
803 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
804 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
807 dstR = (srcR * dstR) / 255;
808 dstG = (srcG * dstG) / 255;
809 dstB = (srcB * dstB) / 255;
812 dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
813 dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
814 dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
817 dstpixel = (dstB << 16) | (dstG << 8) | dstR;
823 info->dst += info->dst_pitch;
827 static void SDL_Blit_RGB888_ARGB8888_Scale(SDL_BlitInfo *info)
830 const Uint32 A = 0xFF;
838 incy = (info->src_h << 16) / info->dst_h;
839 incx = (info->src_w << 16) / info->dst_w;
841 while (info->dst_h--) {
843 Uint32 *dst = (Uint32 *)info->dst;
847 while (posy >= 0x10000L) {
852 if (posx >= 0x10000L) {
853 while (posx >= 0x10000L) {
857 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
860 R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
861 pixel = (A << 24) | (R << 16) | (G << 8) | B;
867 info->dst += info->dst_pitch;
871 static void SDL_Blit_RGB888_ARGB8888_Blend(SDL_BlitInfo *info)
873 const int flags = info->flags;
875 Uint32 srcR, srcG, srcB;
877 Uint32 dstR, dstG, dstB, dstA;
879 while (info->dst_h--) {
880 Uint32 *src = (Uint32 *)info->src;
881 Uint32 *dst = (Uint32 *)info->dst;
885 srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel;
887 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
888 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
896 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
897 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
898 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
901 dstR = (srcR * dstR) / 255;
902 dstG = (srcG * dstG) / 255;
903 dstB = (srcB * dstB) / 255;
906 dstR = (srcR * dstR) / 255;
907 dstG = (srcG * dstG) / 255;
908 dstB = (srcB * dstB) / 255;
912 dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB;
917 info->src += info->src_pitch;
918 info->dst += info->dst_pitch;
922 static void SDL_Blit_RGB888_ARGB8888_Blend_Scale(SDL_BlitInfo *info)
924 const int flags = info->flags;
926 Uint32 srcR, srcG, srcB;
928 Uint32 dstR, dstG, dstB, dstA;
935 incy = (info->src_h << 16) / info->dst_h;
936 incx = (info->src_w << 16) / info->dst_w;
938 while (info->dst_h--) {
940 Uint32 *dst = (Uint32 *)info->dst;
944 while (posy >= 0x10000L) {
949 if (posx >= 0x10000L) {
950 while (posx >= 0x10000L) {
954 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
957 srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel;
959 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
960 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
968 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
969 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
970 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
973 dstR = (srcR * dstR) / 255;
974 dstG = (srcG * dstG) / 255;
975 dstB = (srcB * dstB) / 255;
978 dstR = (srcR * dstR) / 255;
979 dstG = (srcG * dstG) / 255;
980 dstB = (srcB * dstB) / 255;
984 dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB;
990 info->dst += info->dst_pitch;
994 static void SDL_Blit_RGB888_ARGB8888_Modulate(SDL_BlitInfo *info)
996 const int flags = info->flags;
997 const Uint32 modulateR = info->r;
998 const Uint32 modulateG = info->g;
999 const Uint32 modulateB = info->b;
1000 const Uint32 modulateA = info->a;
1002 const Uint32 A = (flags & SDL_COPY_MODULATE_ALPHA) ? modulateA : 0xFF;
1005 while (info->dst_h--) {
1006 Uint32 *src = (Uint32 *)info->src;
1007 Uint32 *dst = (Uint32 *)info->dst;
1008 int n = info->dst_w;
1011 R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
1012 if (flags & SDL_COPY_MODULATE_COLOR) {
1013 R = (R * modulateR) / 255;
1014 G = (G * modulateG) / 255;
1015 B = (B * modulateB) / 255;
1017 pixel = (A << 24) | (R << 16) | (G << 8) | B;
1022 info->src += info->src_pitch;
1023 info->dst += info->dst_pitch;
1027 static void SDL_Blit_RGB888_ARGB8888_Modulate_Scale(SDL_BlitInfo *info)
1029 const int flags = info->flags;
1030 const Uint32 modulateR = info->r;
1031 const Uint32 modulateG = info->g;
1032 const Uint32 modulateB = info->b;
1033 const Uint32 modulateA = info->a;
1035 const Uint32 A = (flags & SDL_COPY_MODULATE_ALPHA) ? modulateA : 0xFF;
1043 incy = (info->src_h << 16) / info->dst_h;
1044 incx = (info->src_w << 16) / info->dst_w;
1046 while (info->dst_h--) {
1048 Uint32 *dst = (Uint32 *)info->dst;
1049 int n = info->dst_w;
1052 while (posy >= 0x10000L) {
1057 if (posx >= 0x10000L) {
1058 while (posx >= 0x10000L) {
1062 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
1065 R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
1066 if (flags & SDL_COPY_MODULATE_COLOR) {
1067 R = (R * modulateR) / 255;
1068 G = (G * modulateG) / 255;
1069 B = (B * modulateB) / 255;
1071 pixel = (A << 24) | (R << 16) | (G << 8) | B;
1077 info->dst += info->dst_pitch;
1081 static void SDL_Blit_RGB888_ARGB8888_Modulate_Blend(SDL_BlitInfo *info)
1083 const int flags = info->flags;
1084 const Uint32 modulateR = info->r;
1085 const Uint32 modulateG = info->g;
1086 const Uint32 modulateB = info->b;
1087 const Uint32 modulateA = info->a;
1089 const Uint32 srcA = (flags & SDL_COPY_MODULATE_ALPHA) ? modulateA : 0xFF;
1090 Uint32 srcR, srcG, srcB;
1092 Uint32 dstR, dstG, dstB, dstA;
1094 while (info->dst_h--) {
1095 Uint32 *src = (Uint32 *)info->src;
1096 Uint32 *dst = (Uint32 *)info->dst;
1097 int n = info->dst_w;
1100 srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel;
1102 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
1103 if (flags & SDL_COPY_MODULATE_COLOR) {
1104 srcR = (srcR * modulateR) / 255;
1105 srcG = (srcG * modulateG) / 255;
1106 srcB = (srcB * modulateB) / 255;
1108 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
1109 /* This goes away if we ever use premultiplied alpha */
1111 srcR = (srcR * srcA) / 255;
1112 srcG = (srcG * srcA) / 255;
1113 srcB = (srcB * srcA) / 255;
1116 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
1117 case SDL_COPY_BLEND:
1118 dstR = srcR + ((255 - srcA) * dstR) / 255;
1119 dstG = srcG + ((255 - srcA) * dstG) / 255;
1120 dstB = srcB + ((255 - srcA) * dstB) / 255;
1121 dstA = srcA + ((255 - srcA) * dstA) / 255;
1124 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
1125 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
1126 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
1129 dstR = (srcR * dstR) / 255;
1130 dstG = (srcG * dstG) / 255;
1131 dstB = (srcB * dstB) / 255;
1134 dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
1135 dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
1136 dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
1137 dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) dstA = 255;
1140 dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB;
1145 info->src += info->src_pitch;
1146 info->dst += info->dst_pitch;
1150 static void SDL_Blit_RGB888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info)
1152 const int flags = info->flags;
1153 const Uint32 modulateR = info->r;
1154 const Uint32 modulateG = info->g;
1155 const Uint32 modulateB = info->b;
1156 const Uint32 modulateA = info->a;
1158 const Uint32 srcA = (flags & SDL_COPY_MODULATE_ALPHA) ? modulateA : 0xFF;
1159 Uint32 srcR, srcG, srcB;
1161 Uint32 dstR, dstG, dstB, dstA;
1168 incy = (info->src_h << 16) / info->dst_h;
1169 incx = (info->src_w << 16) / info->dst_w;
1171 while (info->dst_h--) {
1173 Uint32 *dst = (Uint32 *)info->dst;
1174 int n = info->dst_w;
1177 while (posy >= 0x10000L) {
1182 if (posx >= 0x10000L) {
1183 while (posx >= 0x10000L) {
1187 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
1190 srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel;
1192 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
1193 if (flags & SDL_COPY_MODULATE_COLOR) {
1194 srcR = (srcR * modulateR) / 255;
1195 srcG = (srcG * modulateG) / 255;
1196 srcB = (srcB * modulateB) / 255;
1198 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
1199 /* This goes away if we ever use premultiplied alpha */
1201 srcR = (srcR * srcA) / 255;
1202 srcG = (srcG * srcA) / 255;
1203 srcB = (srcB * srcA) / 255;
1206 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
1207 case SDL_COPY_BLEND:
1208 dstR = srcR + ((255 - srcA) * dstR) / 255;
1209 dstG = srcG + ((255 - srcA) * dstG) / 255;
1210 dstB = srcB + ((255 - srcA) * dstB) / 255;
1211 dstA = srcA + ((255 - srcA) * dstA) / 255;
1214 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
1215 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
1216 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
1219 dstR = (srcR * dstR) / 255;
1220 dstG = (srcG * dstG) / 255;
1221 dstB = (srcB * dstB) / 255;
1224 dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
1225 dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
1226 dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
1227 dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) dstA = 255;
1230 dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB;
1236 info->dst += info->dst_pitch;
1240 static void SDL_Blit_BGR888_RGB888_Scale(SDL_BlitInfo *info)
1250 incy = (info->src_h << 16) / info->dst_h;
1251 incx = (info->src_w << 16) / info->dst_w;
1253 while (info->dst_h--) {
1255 Uint32 *dst = (Uint32 *)info->dst;
1256 int n = info->dst_w;
1259 while (posy >= 0x10000L) {
1264 if (posx >= 0x10000L) {
1265 while (posx >= 0x10000L) {
1269 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
1272 B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
1273 pixel = (R << 16) | (G << 8) | B;
1279 info->dst += info->dst_pitch;
1283 static void SDL_Blit_BGR888_RGB888_Blend(SDL_BlitInfo *info)
1285 const int flags = info->flags;
1287 Uint32 srcR, srcG, srcB;
1289 Uint32 dstR, dstG, dstB;
1291 while (info->dst_h--) {
1292 Uint32 *src = (Uint32 *)info->src;
1293 Uint32 *dst = (Uint32 *)info->dst;
1294 int n = info->dst_w;
1297 srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel;
1299 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
1300 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
1301 case SDL_COPY_BLEND:
1307 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
1308 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
1309 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
1312 dstR = (srcR * dstR) / 255;
1313 dstG = (srcG * dstG) / 255;
1314 dstB = (srcB * dstB) / 255;
1317 dstR = (srcR * dstR) / 255;
1318 dstG = (srcG * dstG) / 255;
1319 dstB = (srcB * dstB) / 255;
1322 dstpixel = (dstR << 16) | (dstG << 8) | dstB;
1327 info->src += info->src_pitch;
1328 info->dst += info->dst_pitch;
1332 static void SDL_Blit_BGR888_RGB888_Blend_Scale(SDL_BlitInfo *info)
1334 const int flags = info->flags;
1336 Uint32 srcR, srcG, srcB;
1338 Uint32 dstR, dstG, dstB;
1345 incy = (info->src_h << 16) / info->dst_h;
1346 incx = (info->src_w << 16) / info->dst_w;
1348 while (info->dst_h--) {
1350 Uint32 *dst = (Uint32 *)info->dst;
1351 int n = info->dst_w;
1354 while (posy >= 0x10000L) {
1359 if (posx >= 0x10000L) {
1360 while (posx >= 0x10000L) {
1364 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
1367 srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel;
1369 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
1370 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
1371 case SDL_COPY_BLEND:
1377 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
1378 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
1379 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
1382 dstR = (srcR * dstR) / 255;
1383 dstG = (srcG * dstG) / 255;
1384 dstB = (srcB * dstB) / 255;
1387 dstR = (srcR * dstR) / 255;
1388 dstG = (srcG * dstG) / 255;
1389 dstB = (srcB * dstB) / 255;
1392 dstpixel = (dstR << 16) | (dstG << 8) | dstB;
1398 info->dst += info->dst_pitch;
1402 static void SDL_Blit_BGR888_RGB888_Modulate(SDL_BlitInfo *info)
1404 const int flags = info->flags;
1405 const Uint32 modulateR = info->r;
1406 const Uint32 modulateG = info->g;
1407 const Uint32 modulateB = info->b;
1411 while (info->dst_h--) {
1412 Uint32 *src = (Uint32 *)info->src;
1413 Uint32 *dst = (Uint32 *)info->dst;
1414 int n = info->dst_w;
1417 B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
1418 if (flags & SDL_COPY_MODULATE_COLOR) {
1419 R = (R * modulateR) / 255;
1420 G = (G * modulateG) / 255;
1421 B = (B * modulateB) / 255;
1423 pixel = (R << 16) | (G << 8) | B;
1428 info->src += info->src_pitch;
1429 info->dst += info->dst_pitch;
1433 static void SDL_Blit_BGR888_RGB888_Modulate_Scale(SDL_BlitInfo *info)
1435 const int flags = info->flags;
1436 const Uint32 modulateR = info->r;
1437 const Uint32 modulateG = info->g;
1438 const Uint32 modulateB = info->b;
1447 incy = (info->src_h << 16) / info->dst_h;
1448 incx = (info->src_w << 16) / info->dst_w;
1450 while (info->dst_h--) {
1452 Uint32 *dst = (Uint32 *)info->dst;
1453 int n = info->dst_w;
1456 while (posy >= 0x10000L) {
1461 if (posx >= 0x10000L) {
1462 while (posx >= 0x10000L) {
1466 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
1469 B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
1470 if (flags & SDL_COPY_MODULATE_COLOR) {
1471 R = (R * modulateR) / 255;
1472 G = (G * modulateG) / 255;
1473 B = (B * modulateB) / 255;
1475 pixel = (R << 16) | (G << 8) | B;
1481 info->dst += info->dst_pitch;
1485 static void SDL_Blit_BGR888_RGB888_Modulate_Blend(SDL_BlitInfo *info)
1487 const int flags = info->flags;
1488 const Uint32 modulateR = info->r;
1489 const Uint32 modulateG = info->g;
1490 const Uint32 modulateB = info->b;
1491 const Uint32 modulateA = info->a;
1493 const Uint32 srcA = (flags & SDL_COPY_MODULATE_ALPHA) ? modulateA : 0xFF;
1494 Uint32 srcR, srcG, srcB;
1496 Uint32 dstR, dstG, dstB;
1498 while (info->dst_h--) {
1499 Uint32 *src = (Uint32 *)info->src;
1500 Uint32 *dst = (Uint32 *)info->dst;
1501 int n = info->dst_w;
1504 srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel;
1506 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
1507 if (flags & SDL_COPY_MODULATE_COLOR) {
1508 srcR = (srcR * modulateR) / 255;
1509 srcG = (srcG * modulateG) / 255;
1510 srcB = (srcB * modulateB) / 255;
1512 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
1513 /* This goes away if we ever use premultiplied alpha */
1515 srcR = (srcR * srcA) / 255;
1516 srcG = (srcG * srcA) / 255;
1517 srcB = (srcB * srcA) / 255;
1520 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
1521 case SDL_COPY_BLEND:
1522 dstR = srcR + ((255 - srcA) * dstR) / 255;
1523 dstG = srcG + ((255 - srcA) * dstG) / 255;
1524 dstB = srcB + ((255 - srcA) * dstB) / 255;
1527 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
1528 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
1529 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
1532 dstR = (srcR * dstR) / 255;
1533 dstG = (srcG * dstG) / 255;
1534 dstB = (srcB * dstB) / 255;
1537 dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
1538 dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
1539 dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
1542 dstpixel = (dstR << 16) | (dstG << 8) | dstB;
1547 info->src += info->src_pitch;
1548 info->dst += info->dst_pitch;
1552 static void SDL_Blit_BGR888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info)
1554 const int flags = info->flags;
1555 const Uint32 modulateR = info->r;
1556 const Uint32 modulateG = info->g;
1557 const Uint32 modulateB = info->b;
1558 const Uint32 modulateA = info->a;
1560 const Uint32 srcA = (flags & SDL_COPY_MODULATE_ALPHA) ? modulateA : 0xFF;
1561 Uint32 srcR, srcG, srcB;
1563 Uint32 dstR, dstG, dstB;
1570 incy = (info->src_h << 16) / info->dst_h;
1571 incx = (info->src_w << 16) / info->dst_w;
1573 while (info->dst_h--) {
1575 Uint32 *dst = (Uint32 *)info->dst;
1576 int n = info->dst_w;
1579 while (posy >= 0x10000L) {
1584 if (posx >= 0x10000L) {
1585 while (posx >= 0x10000L) {
1589 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
1592 srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel;
1594 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
1595 if (flags & SDL_COPY_MODULATE_COLOR) {
1596 srcR = (srcR * modulateR) / 255;
1597 srcG = (srcG * modulateG) / 255;
1598 srcB = (srcB * modulateB) / 255;
1600 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
1601 /* This goes away if we ever use premultiplied alpha */
1603 srcR = (srcR * srcA) / 255;
1604 srcG = (srcG * srcA) / 255;
1605 srcB = (srcB * srcA) / 255;
1608 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
1609 case SDL_COPY_BLEND:
1610 dstR = srcR + ((255 - srcA) * dstR) / 255;
1611 dstG = srcG + ((255 - srcA) * dstG) / 255;
1612 dstB = srcB + ((255 - srcA) * dstB) / 255;
1615 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
1616 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
1617 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
1620 dstR = (srcR * dstR) / 255;
1621 dstG = (srcG * dstG) / 255;
1622 dstB = (srcB * dstB) / 255;
1625 dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
1626 dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
1627 dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
1630 dstpixel = (dstR << 16) | (dstG << 8) | dstB;
1636 info->dst += info->dst_pitch;
1640 static void SDL_Blit_BGR888_BGR888_Scale(SDL_BlitInfo *info)
1648 incy = (info->src_h << 16) / info->dst_h;
1649 incx = (info->src_w << 16) / info->dst_w;
1651 while (info->dst_h--) {
1653 Uint32 *dst = (Uint32 *)info->dst;
1654 int n = info->dst_w;
1657 while (posy >= 0x10000L) {
1662 if (posx >= 0x10000L) {
1663 while (posx >= 0x10000L) {
1667 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
1674 info->dst += info->dst_pitch;
1678 static void SDL_Blit_BGR888_BGR888_Blend(SDL_BlitInfo *info)
1680 const int flags = info->flags;
1682 Uint32 srcR, srcG, srcB;
1684 Uint32 dstR, dstG, dstB;
1686 while (info->dst_h--) {
1687 Uint32 *src = (Uint32 *)info->src;
1688 Uint32 *dst = (Uint32 *)info->dst;
1689 int n = info->dst_w;
1692 srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel;
1694 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel;
1695 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
1696 case SDL_COPY_BLEND:
1702 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
1703 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
1704 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
1707 dstR = (srcR * dstR) / 255;
1708 dstG = (srcG * dstG) / 255;
1709 dstB = (srcB * dstB) / 255;
1712 dstR = (srcR * dstR) / 255;
1713 dstG = (srcG * dstG) / 255;
1714 dstB = (srcB * dstB) / 255;
1717 dstpixel = (dstB << 16) | (dstG << 8) | dstR;
1722 info->src += info->src_pitch;
1723 info->dst += info->dst_pitch;
1727 static void SDL_Blit_BGR888_BGR888_Blend_Scale(SDL_BlitInfo *info)
1729 const int flags = info->flags;
1731 Uint32 srcR, srcG, srcB;
1733 Uint32 dstR, dstG, dstB;
1740 incy = (info->src_h << 16) / info->dst_h;
1741 incx = (info->src_w << 16) / info->dst_w;
1743 while (info->dst_h--) {
1745 Uint32 *dst = (Uint32 *)info->dst;
1746 int n = info->dst_w;
1749 while (posy >= 0x10000L) {
1754 if (posx >= 0x10000L) {
1755 while (posx >= 0x10000L) {
1759 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
1762 srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel;
1764 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel;
1765 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
1766 case SDL_COPY_BLEND:
1772 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
1773 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
1774 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
1777 dstR = (srcR * dstR) / 255;
1778 dstG = (srcG * dstG) / 255;
1779 dstB = (srcB * dstB) / 255;
1782 dstR = (srcR * dstR) / 255;
1783 dstG = (srcG * dstG) / 255;
1784 dstB = (srcB * dstB) / 255;
1787 dstpixel = (dstB << 16) | (dstG << 8) | dstR;
1793 info->dst += info->dst_pitch;
1797 static void SDL_Blit_BGR888_BGR888_Modulate(SDL_BlitInfo *info)
1799 const int flags = info->flags;
1800 const Uint32 modulateR = info->r;
1801 const Uint32 modulateG = info->g;
1802 const Uint32 modulateB = info->b;
1806 while (info->dst_h--) {
1807 Uint32 *src = (Uint32 *)info->src;
1808 Uint32 *dst = (Uint32 *)info->dst;
1809 int n = info->dst_w;
1812 B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
1813 if (flags & SDL_COPY_MODULATE_COLOR) {
1814 R = (R * modulateR) / 255;
1815 G = (G * modulateG) / 255;
1816 B = (B * modulateB) / 255;
1818 pixel = (B << 16) | (G << 8) | R;
1823 info->src += info->src_pitch;
1824 info->dst += info->dst_pitch;
1828 static void SDL_Blit_BGR888_BGR888_Modulate_Scale(SDL_BlitInfo *info)
1830 const int flags = info->flags;
1831 const Uint32 modulateR = info->r;
1832 const Uint32 modulateG = info->g;
1833 const Uint32 modulateB = info->b;
1842 incy = (info->src_h << 16) / info->dst_h;
1843 incx = (info->src_w << 16) / info->dst_w;
1845 while (info->dst_h--) {
1847 Uint32 *dst = (Uint32 *)info->dst;
1848 int n = info->dst_w;
1851 while (posy >= 0x10000L) {
1856 if (posx >= 0x10000L) {
1857 while (posx >= 0x10000L) {
1861 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
1864 B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
1865 if (flags & SDL_COPY_MODULATE_COLOR) {
1866 R = (R * modulateR) / 255;
1867 G = (G * modulateG) / 255;
1868 B = (B * modulateB) / 255;
1870 pixel = (B << 16) | (G << 8) | R;
1876 info->dst += info->dst_pitch;
1880 static void SDL_Blit_BGR888_BGR888_Modulate_Blend(SDL_BlitInfo *info)
1882 const int flags = info->flags;
1883 const Uint32 modulateR = info->r;
1884 const Uint32 modulateG = info->g;
1885 const Uint32 modulateB = info->b;
1886 const Uint32 modulateA = info->a;
1888 const Uint32 srcA = (flags & SDL_COPY_MODULATE_ALPHA) ? modulateA : 0xFF;
1889 Uint32 srcR, srcG, srcB;
1891 Uint32 dstR, dstG, dstB;
1893 while (info->dst_h--) {
1894 Uint32 *src = (Uint32 *)info->src;
1895 Uint32 *dst = (Uint32 *)info->dst;
1896 int n = info->dst_w;
1899 srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel;
1901 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel;
1902 if (flags & SDL_COPY_MODULATE_COLOR) {
1903 srcR = (srcR * modulateR) / 255;
1904 srcG = (srcG * modulateG) / 255;
1905 srcB = (srcB * modulateB) / 255;
1907 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
1908 /* This goes away if we ever use premultiplied alpha */
1910 srcR = (srcR * srcA) / 255;
1911 srcG = (srcG * srcA) / 255;
1912 srcB = (srcB * srcA) / 255;
1915 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
1916 case SDL_COPY_BLEND:
1917 dstR = srcR + ((255 - srcA) * dstR) / 255;
1918 dstG = srcG + ((255 - srcA) * dstG) / 255;
1919 dstB = srcB + ((255 - srcA) * dstB) / 255;
1922 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
1923 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
1924 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
1927 dstR = (srcR * dstR) / 255;
1928 dstG = (srcG * dstG) / 255;
1929 dstB = (srcB * dstB) / 255;
1932 dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
1933 dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
1934 dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
1937 dstpixel = (dstB << 16) | (dstG << 8) | dstR;
1942 info->src += info->src_pitch;
1943 info->dst += info->dst_pitch;
1947 static void SDL_Blit_BGR888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info)
1949 const int flags = info->flags;
1950 const Uint32 modulateR = info->r;
1951 const Uint32 modulateG = info->g;
1952 const Uint32 modulateB = info->b;
1953 const Uint32 modulateA = info->a;
1955 const Uint32 srcA = (flags & SDL_COPY_MODULATE_ALPHA) ? modulateA : 0xFF;
1956 Uint32 srcR, srcG, srcB;
1958 Uint32 dstR, dstG, dstB;
1965 incy = (info->src_h << 16) / info->dst_h;
1966 incx = (info->src_w << 16) / info->dst_w;
1968 while (info->dst_h--) {
1970 Uint32 *dst = (Uint32 *)info->dst;
1971 int n = info->dst_w;
1974 while (posy >= 0x10000L) {
1979 if (posx >= 0x10000L) {
1980 while (posx >= 0x10000L) {
1984 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
1987 srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel;
1989 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel;
1990 if (flags & SDL_COPY_MODULATE_COLOR) {
1991 srcR = (srcR * modulateR) / 255;
1992 srcG = (srcG * modulateG) / 255;
1993 srcB = (srcB * modulateB) / 255;
1995 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
1996 /* This goes away if we ever use premultiplied alpha */
1998 srcR = (srcR * srcA) / 255;
1999 srcG = (srcG * srcA) / 255;
2000 srcB = (srcB * srcA) / 255;
2003 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
2004 case SDL_COPY_BLEND:
2005 dstR = srcR + ((255 - srcA) * dstR) / 255;
2006 dstG = srcG + ((255 - srcA) * dstG) / 255;
2007 dstB = srcB + ((255 - srcA) * dstB) / 255;
2010 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
2011 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
2012 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
2015 dstR = (srcR * dstR) / 255;
2016 dstG = (srcG * dstG) / 255;
2017 dstB = (srcB * dstB) / 255;
2020 dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
2021 dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
2022 dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
2025 dstpixel = (dstB << 16) | (dstG << 8) | dstR;
2031 info->dst += info->dst_pitch;
2035 static void SDL_Blit_BGR888_ARGB8888_Scale(SDL_BlitInfo *info)
2038 const Uint32 A = 0xFF;
2046 incy = (info->src_h << 16) / info->dst_h;
2047 incx = (info->src_w << 16) / info->dst_w;
2049 while (info->dst_h--) {
2051 Uint32 *dst = (Uint32 *)info->dst;
2052 int n = info->dst_w;
2055 while (posy >= 0x10000L) {
2060 if (posx >= 0x10000L) {
2061 while (posx >= 0x10000L) {
2065 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
2068 B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
2069 pixel = (A << 24) | (R << 16) | (G << 8) | B;
2075 info->dst += info->dst_pitch;
2079 static void SDL_Blit_BGR888_ARGB8888_Blend(SDL_BlitInfo *info)
2081 const int flags = info->flags;
2083 Uint32 srcR, srcG, srcB;
2085 Uint32 dstR, dstG, dstB, dstA;
2087 while (info->dst_h--) {
2088 Uint32 *src = (Uint32 *)info->src;
2089 Uint32 *dst = (Uint32 *)info->dst;
2090 int n = info->dst_w;
2093 srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel;
2095 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
2096 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
2097 case SDL_COPY_BLEND:
2104 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
2105 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
2106 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
2109 dstR = (srcR * dstR) / 255;
2110 dstG = (srcG * dstG) / 255;
2111 dstB = (srcB * dstB) / 255;
2114 dstR = (srcR * dstR) / 255;
2115 dstG = (srcG * dstG) / 255;
2116 dstB = (srcB * dstB) / 255;
2120 dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB;
2125 info->src += info->src_pitch;
2126 info->dst += info->dst_pitch;
2130 static void SDL_Blit_BGR888_ARGB8888_Blend_Scale(SDL_BlitInfo *info)
2132 const int flags = info->flags;
2134 Uint32 srcR, srcG, srcB;
2136 Uint32 dstR, dstG, dstB, dstA;
2143 incy = (info->src_h << 16) / info->dst_h;
2144 incx = (info->src_w << 16) / info->dst_w;
2146 while (info->dst_h--) {
2148 Uint32 *dst = (Uint32 *)info->dst;
2149 int n = info->dst_w;
2152 while (posy >= 0x10000L) {
2157 if (posx >= 0x10000L) {
2158 while (posx >= 0x10000L) {
2162 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
2165 srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel;
2167 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
2168 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
2169 case SDL_COPY_BLEND:
2176 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
2177 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
2178 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
2181 dstR = (srcR * dstR) / 255;
2182 dstG = (srcG * dstG) / 255;
2183 dstB = (srcB * dstB) / 255;
2186 dstR = (srcR * dstR) / 255;
2187 dstG = (srcG * dstG) / 255;
2188 dstB = (srcB * dstB) / 255;
2192 dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB;
2198 info->dst += info->dst_pitch;
2202 static void SDL_Blit_BGR888_ARGB8888_Modulate(SDL_BlitInfo *info)
2204 const int flags = info->flags;
2205 const Uint32 modulateR = info->r;
2206 const Uint32 modulateG = info->g;
2207 const Uint32 modulateB = info->b;
2208 const Uint32 modulateA = info->a;
2210 const Uint32 A = (flags & SDL_COPY_MODULATE_ALPHA) ? modulateA : 0xFF;
2213 while (info->dst_h--) {
2214 Uint32 *src = (Uint32 *)info->src;
2215 Uint32 *dst = (Uint32 *)info->dst;
2216 int n = info->dst_w;
2219 B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
2220 if (flags & SDL_COPY_MODULATE_COLOR) {
2221 R = (R * modulateR) / 255;
2222 G = (G * modulateG) / 255;
2223 B = (B * modulateB) / 255;
2225 pixel = (A << 24) | (R << 16) | (G << 8) | B;
2230 info->src += info->src_pitch;
2231 info->dst += info->dst_pitch;
2235 static void SDL_Blit_BGR888_ARGB8888_Modulate_Scale(SDL_BlitInfo *info)
2237 const int flags = info->flags;
2238 const Uint32 modulateR = info->r;
2239 const Uint32 modulateG = info->g;
2240 const Uint32 modulateB = info->b;
2241 const Uint32 modulateA = info->a;
2243 const Uint32 A = (flags & SDL_COPY_MODULATE_ALPHA) ? modulateA : 0xFF;
2251 incy = (info->src_h << 16) / info->dst_h;
2252 incx = (info->src_w << 16) / info->dst_w;
2254 while (info->dst_h--) {
2256 Uint32 *dst = (Uint32 *)info->dst;
2257 int n = info->dst_w;
2260 while (posy >= 0x10000L) {
2265 if (posx >= 0x10000L) {
2266 while (posx >= 0x10000L) {
2270 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
2273 B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
2274 if (flags & SDL_COPY_MODULATE_COLOR) {
2275 R = (R * modulateR) / 255;
2276 G = (G * modulateG) / 255;
2277 B = (B * modulateB) / 255;
2279 pixel = (A << 24) | (R << 16) | (G << 8) | B;
2285 info->dst += info->dst_pitch;
2289 static void SDL_Blit_BGR888_ARGB8888_Modulate_Blend(SDL_BlitInfo *info)
2291 const int flags = info->flags;
2292 const Uint32 modulateR = info->r;
2293 const Uint32 modulateG = info->g;
2294 const Uint32 modulateB = info->b;
2295 const Uint32 modulateA = info->a;
2297 const Uint32 srcA = (flags & SDL_COPY_MODULATE_ALPHA) ? modulateA : 0xFF;
2298 Uint32 srcR, srcG, srcB;
2300 Uint32 dstR, dstG, dstB, dstA;
2302 while (info->dst_h--) {
2303 Uint32 *src = (Uint32 *)info->src;
2304 Uint32 *dst = (Uint32 *)info->dst;
2305 int n = info->dst_w;
2308 srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel;
2310 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
2311 if (flags & SDL_COPY_MODULATE_COLOR) {
2312 srcR = (srcR * modulateR) / 255;
2313 srcG = (srcG * modulateG) / 255;
2314 srcB = (srcB * modulateB) / 255;
2316 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
2317 /* This goes away if we ever use premultiplied alpha */
2319 srcR = (srcR * srcA) / 255;
2320 srcG = (srcG * srcA) / 255;
2321 srcB = (srcB * srcA) / 255;
2324 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
2325 case SDL_COPY_BLEND:
2326 dstR = srcR + ((255 - srcA) * dstR) / 255;
2327 dstG = srcG + ((255 - srcA) * dstG) / 255;
2328 dstB = srcB + ((255 - srcA) * dstB) / 255;
2329 dstA = srcA + ((255 - srcA) * dstA) / 255;
2332 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
2333 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
2334 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
2337 dstR = (srcR * dstR) / 255;
2338 dstG = (srcG * dstG) / 255;
2339 dstB = (srcB * dstB) / 255;
2342 dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
2343 dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
2344 dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
2345 dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) dstA = 255;
2348 dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB;
2353 info->src += info->src_pitch;
2354 info->dst += info->dst_pitch;
2358 static void SDL_Blit_BGR888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info)
2360 const int flags = info->flags;
2361 const Uint32 modulateR = info->r;
2362 const Uint32 modulateG = info->g;
2363 const Uint32 modulateB = info->b;
2364 const Uint32 modulateA = info->a;
2366 const Uint32 srcA = (flags & SDL_COPY_MODULATE_ALPHA) ? modulateA : 0xFF;
2367 Uint32 srcR, srcG, srcB;
2369 Uint32 dstR, dstG, dstB, dstA;
2376 incy = (info->src_h << 16) / info->dst_h;
2377 incx = (info->src_w << 16) / info->dst_w;
2379 while (info->dst_h--) {
2381 Uint32 *dst = (Uint32 *)info->dst;
2382 int n = info->dst_w;
2385 while (posy >= 0x10000L) {
2390 if (posx >= 0x10000L) {
2391 while (posx >= 0x10000L) {
2395 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
2398 srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel;
2400 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
2401 if (flags & SDL_COPY_MODULATE_COLOR) {
2402 srcR = (srcR * modulateR) / 255;
2403 srcG = (srcG * modulateG) / 255;
2404 srcB = (srcB * modulateB) / 255;
2406 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
2407 /* This goes away if we ever use premultiplied alpha */
2409 srcR = (srcR * srcA) / 255;
2410 srcG = (srcG * srcA) / 255;
2411 srcB = (srcB * srcA) / 255;
2414 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
2415 case SDL_COPY_BLEND:
2416 dstR = srcR + ((255 - srcA) * dstR) / 255;
2417 dstG = srcG + ((255 - srcA) * dstG) / 255;
2418 dstB = srcB + ((255 - srcA) * dstB) / 255;
2419 dstA = srcA + ((255 - srcA) * dstA) / 255;
2422 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
2423 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
2424 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
2427 dstR = (srcR * dstR) / 255;
2428 dstG = (srcG * dstG) / 255;
2429 dstB = (srcB * dstB) / 255;
2432 dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
2433 dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
2434 dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
2435 dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) dstA = 255;
2438 dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB;
2444 info->dst += info->dst_pitch;
2448 static void SDL_Blit_ARGB8888_RGB888_Scale(SDL_BlitInfo *info)
2458 incy = (info->src_h << 16) / info->dst_h;
2459 incx = (info->src_w << 16) / info->dst_w;
2461 while (info->dst_h--) {
2463 Uint32 *dst = (Uint32 *)info->dst;
2464 int n = info->dst_w;
2467 while (posy >= 0x10000L) {
2472 if (posx >= 0x10000L) {
2473 while (posx >= 0x10000L) {
2477 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
2480 R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
2481 pixel = (R << 16) | (G << 8) | B;
2487 info->dst += info->dst_pitch;
2491 static void SDL_Blit_ARGB8888_RGB888_Blend(SDL_BlitInfo *info)
2493 const int flags = info->flags;
2495 Uint32 srcR, srcG, srcB, srcA;
2497 Uint32 dstR, dstG, dstB;
2499 while (info->dst_h--) {
2500 Uint32 *src = (Uint32 *)info->src;
2501 Uint32 *dst = (Uint32 *)info->dst;
2502 int n = info->dst_w;
2505 srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
2507 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
2508 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
2509 /* This goes away if we ever use premultiplied alpha */
2511 srcR = (srcR * srcA) / 255;
2512 srcG = (srcG * srcA) / 255;
2513 srcB = (srcB * srcA) / 255;
2516 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
2517 case SDL_COPY_BLEND:
2518 dstR = srcR + ((255 - srcA) * dstR) / 255;
2519 dstG = srcG + ((255 - srcA) * dstG) / 255;
2520 dstB = srcB + ((255 - srcA) * dstB) / 255;
2523 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
2524 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
2525 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
2528 dstR = (srcR * dstR) / 255;
2529 dstG = (srcG * dstG) / 255;
2530 dstB = (srcB * dstB) / 255;
2533 dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
2534 dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
2535 dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
2538 dstpixel = (dstR << 16) | (dstG << 8) | dstB;
2543 info->src += info->src_pitch;
2544 info->dst += info->dst_pitch;
2548 static void SDL_Blit_ARGB8888_RGB888_Blend_Scale(SDL_BlitInfo *info)
2550 const int flags = info->flags;
2552 Uint32 srcR, srcG, srcB, srcA;
2554 Uint32 dstR, dstG, dstB;
2561 incy = (info->src_h << 16) / info->dst_h;
2562 incx = (info->src_w << 16) / info->dst_w;
2564 while (info->dst_h--) {
2566 Uint32 *dst = (Uint32 *)info->dst;
2567 int n = info->dst_w;
2570 while (posy >= 0x10000L) {
2575 if (posx >= 0x10000L) {
2576 while (posx >= 0x10000L) {
2580 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
2583 srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
2585 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
2586 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
2587 /* This goes away if we ever use premultiplied alpha */
2589 srcR = (srcR * srcA) / 255;
2590 srcG = (srcG * srcA) / 255;
2591 srcB = (srcB * srcA) / 255;
2594 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
2595 case SDL_COPY_BLEND:
2596 dstR = srcR + ((255 - srcA) * dstR) / 255;
2597 dstG = srcG + ((255 - srcA) * dstG) / 255;
2598 dstB = srcB + ((255 - srcA) * dstB) / 255;
2601 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
2602 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
2603 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
2606 dstR = (srcR * dstR) / 255;
2607 dstG = (srcG * dstG) / 255;
2608 dstB = (srcB * dstB) / 255;
2611 dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
2612 dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
2613 dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
2616 dstpixel = (dstR << 16) | (dstG << 8) | dstB;
2622 info->dst += info->dst_pitch;
2626 static void SDL_Blit_ARGB8888_RGB888_Modulate(SDL_BlitInfo *info)
2628 const int flags = info->flags;
2629 const Uint32 modulateR = info->r;
2630 const Uint32 modulateG = info->g;
2631 const Uint32 modulateB = info->b;
2635 while (info->dst_h--) {
2636 Uint32 *src = (Uint32 *)info->src;
2637 Uint32 *dst = (Uint32 *)info->dst;
2638 int n = info->dst_w;
2641 R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
2642 if (flags & SDL_COPY_MODULATE_COLOR) {
2643 R = (R * modulateR) / 255;
2644 G = (G * modulateG) / 255;
2645 B = (B * modulateB) / 255;
2647 pixel = (R << 16) | (G << 8) | B;
2652 info->src += info->src_pitch;
2653 info->dst += info->dst_pitch;
2657 static void SDL_Blit_ARGB8888_RGB888_Modulate_Scale(SDL_BlitInfo *info)
2659 const int flags = info->flags;
2660 const Uint32 modulateR = info->r;
2661 const Uint32 modulateG = info->g;
2662 const Uint32 modulateB = info->b;
2671 incy = (info->src_h << 16) / info->dst_h;
2672 incx = (info->src_w << 16) / info->dst_w;
2674 while (info->dst_h--) {
2676 Uint32 *dst = (Uint32 *)info->dst;
2677 int n = info->dst_w;
2680 while (posy >= 0x10000L) {
2685 if (posx >= 0x10000L) {
2686 while (posx >= 0x10000L) {
2690 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
2693 R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
2694 if (flags & SDL_COPY_MODULATE_COLOR) {
2695 R = (R * modulateR) / 255;
2696 G = (G * modulateG) / 255;
2697 B = (B * modulateB) / 255;
2699 pixel = (R << 16) | (G << 8) | B;
2705 info->dst += info->dst_pitch;
2709 static void SDL_Blit_ARGB8888_RGB888_Modulate_Blend(SDL_BlitInfo *info)
2711 const int flags = info->flags;
2712 const Uint32 modulateR = info->r;
2713 const Uint32 modulateG = info->g;
2714 const Uint32 modulateB = info->b;
2715 const Uint32 modulateA = info->a;
2717 Uint32 srcR, srcG, srcB, srcA;
2719 Uint32 dstR, dstG, dstB;
2721 while (info->dst_h--) {
2722 Uint32 *src = (Uint32 *)info->src;
2723 Uint32 *dst = (Uint32 *)info->dst;
2724 int n = info->dst_w;
2727 srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
2729 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
2730 if (flags & SDL_COPY_MODULATE_COLOR) {
2731 srcR = (srcR * modulateR) / 255;
2732 srcG = (srcG * modulateG) / 255;
2733 srcB = (srcB * modulateB) / 255;
2735 if (flags & SDL_COPY_MODULATE_ALPHA) {
2736 srcA = (srcA * modulateA) / 255;
2738 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
2739 /* This goes away if we ever use premultiplied alpha */
2741 srcR = (srcR * srcA) / 255;
2742 srcG = (srcG * srcA) / 255;
2743 srcB = (srcB * srcA) / 255;
2746 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
2747 case SDL_COPY_BLEND:
2748 dstR = srcR + ((255 - srcA) * dstR) / 255;
2749 dstG = srcG + ((255 - srcA) * dstG) / 255;
2750 dstB = srcB + ((255 - srcA) * dstB) / 255;
2753 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
2754 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
2755 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
2758 dstR = (srcR * dstR) / 255;
2759 dstG = (srcG * dstG) / 255;
2760 dstB = (srcB * dstB) / 255;
2763 dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
2764 dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
2765 dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
2768 dstpixel = (dstR << 16) | (dstG << 8) | dstB;
2773 info->src += info->src_pitch;
2774 info->dst += info->dst_pitch;
2778 static void SDL_Blit_ARGB8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info)
2780 const int flags = info->flags;
2781 const Uint32 modulateR = info->r;
2782 const Uint32 modulateG = info->g;
2783 const Uint32 modulateB = info->b;
2784 const Uint32 modulateA = info->a;
2786 Uint32 srcR, srcG, srcB, srcA;
2788 Uint32 dstR, dstG, dstB;
2795 incy = (info->src_h << 16) / info->dst_h;
2796 incx = (info->src_w << 16) / info->dst_w;
2798 while (info->dst_h--) {
2800 Uint32 *dst = (Uint32 *)info->dst;
2801 int n = info->dst_w;
2804 while (posy >= 0x10000L) {
2809 if (posx >= 0x10000L) {
2810 while (posx >= 0x10000L) {
2814 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
2817 srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
2819 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
2820 if (flags & SDL_COPY_MODULATE_COLOR) {
2821 srcR = (srcR * modulateR) / 255;
2822 srcG = (srcG * modulateG) / 255;
2823 srcB = (srcB * modulateB) / 255;
2825 if (flags & SDL_COPY_MODULATE_ALPHA) {
2826 srcA = (srcA * modulateA) / 255;
2828 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
2829 /* This goes away if we ever use premultiplied alpha */
2831 srcR = (srcR * srcA) / 255;
2832 srcG = (srcG * srcA) / 255;
2833 srcB = (srcB * srcA) / 255;
2836 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
2837 case SDL_COPY_BLEND:
2838 dstR = srcR + ((255 - srcA) * dstR) / 255;
2839 dstG = srcG + ((255 - srcA) * dstG) / 255;
2840 dstB = srcB + ((255 - srcA) * dstB) / 255;
2843 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
2844 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
2845 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
2848 dstR = (srcR * dstR) / 255;
2849 dstG = (srcG * dstG) / 255;
2850 dstB = (srcB * dstB) / 255;
2853 dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
2854 dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
2855 dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
2858 dstpixel = (dstR << 16) | (dstG << 8) | dstB;
2864 info->dst += info->dst_pitch;
2868 static void SDL_Blit_ARGB8888_BGR888_Scale(SDL_BlitInfo *info)
2878 incy = (info->src_h << 16) / info->dst_h;
2879 incx = (info->src_w << 16) / info->dst_w;
2881 while (info->dst_h--) {
2883 Uint32 *dst = (Uint32 *)info->dst;
2884 int n = info->dst_w;
2887 while (posy >= 0x10000L) {
2892 if (posx >= 0x10000L) {
2893 while (posx >= 0x10000L) {
2897 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
2900 R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
2901 pixel = (B << 16) | (G << 8) | R;
2907 info->dst += info->dst_pitch;
2911 static void SDL_Blit_ARGB8888_BGR888_Blend(SDL_BlitInfo *info)
2913 const int flags = info->flags;
2915 Uint32 srcR, srcG, srcB, srcA;
2917 Uint32 dstR, dstG, dstB;
2919 while (info->dst_h--) {
2920 Uint32 *src = (Uint32 *)info->src;
2921 Uint32 *dst = (Uint32 *)info->dst;
2922 int n = info->dst_w;
2925 srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
2927 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel;
2928 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
2929 /* This goes away if we ever use premultiplied alpha */
2931 srcR = (srcR * srcA) / 255;
2932 srcG = (srcG * srcA) / 255;
2933 srcB = (srcB * srcA) / 255;
2936 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
2937 case SDL_COPY_BLEND:
2938 dstR = srcR + ((255 - srcA) * dstR) / 255;
2939 dstG = srcG + ((255 - srcA) * dstG) / 255;
2940 dstB = srcB + ((255 - srcA) * dstB) / 255;
2943 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
2944 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
2945 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
2948 dstR = (srcR * dstR) / 255;
2949 dstG = (srcG * dstG) / 255;
2950 dstB = (srcB * dstB) / 255;
2953 dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
2954 dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
2955 dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
2958 dstpixel = (dstB << 16) | (dstG << 8) | dstR;
2963 info->src += info->src_pitch;
2964 info->dst += info->dst_pitch;
2968 static void SDL_Blit_ARGB8888_BGR888_Blend_Scale(SDL_BlitInfo *info)
2970 const int flags = info->flags;
2972 Uint32 srcR, srcG, srcB, srcA;
2974 Uint32 dstR, dstG, dstB;
2981 incy = (info->src_h << 16) / info->dst_h;
2982 incx = (info->src_w << 16) / info->dst_w;
2984 while (info->dst_h--) {
2986 Uint32 *dst = (Uint32 *)info->dst;
2987 int n = info->dst_w;
2990 while (posy >= 0x10000L) {
2995 if (posx >= 0x10000L) {
2996 while (posx >= 0x10000L) {
3000 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
3003 srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
3005 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel;
3006 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
3007 /* This goes away if we ever use premultiplied alpha */
3009 srcR = (srcR * srcA) / 255;
3010 srcG = (srcG * srcA) / 255;
3011 srcB = (srcB * srcA) / 255;
3014 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
3015 case SDL_COPY_BLEND:
3016 dstR = srcR + ((255 - srcA) * dstR) / 255;
3017 dstG = srcG + ((255 - srcA) * dstG) / 255;
3018 dstB = srcB + ((255 - srcA) * dstB) / 255;
3021 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
3022 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
3023 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
3026 dstR = (srcR * dstR) / 255;
3027 dstG = (srcG * dstG) / 255;
3028 dstB = (srcB * dstB) / 255;
3031 dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
3032 dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
3033 dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
3036 dstpixel = (dstB << 16) | (dstG << 8) | dstR;
3042 info->dst += info->dst_pitch;
3046 static void SDL_Blit_ARGB8888_BGR888_Modulate(SDL_BlitInfo *info)
3048 const int flags = info->flags;
3049 const Uint32 modulateR = info->r;
3050 const Uint32 modulateG = info->g;
3051 const Uint32 modulateB = info->b;
3055 while (info->dst_h--) {
3056 Uint32 *src = (Uint32 *)info->src;
3057 Uint32 *dst = (Uint32 *)info->dst;
3058 int n = info->dst_w;
3061 R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
3062 if (flags & SDL_COPY_MODULATE_COLOR) {
3063 R = (R * modulateR) / 255;
3064 G = (G * modulateG) / 255;
3065 B = (B * modulateB) / 255;
3067 pixel = (B << 16) | (G << 8) | R;
3072 info->src += info->src_pitch;
3073 info->dst += info->dst_pitch;
3077 static void SDL_Blit_ARGB8888_BGR888_Modulate_Scale(SDL_BlitInfo *info)
3079 const int flags = info->flags;
3080 const Uint32 modulateR = info->r;
3081 const Uint32 modulateG = info->g;
3082 const Uint32 modulateB = info->b;
3091 incy = (info->src_h << 16) / info->dst_h;
3092 incx = (info->src_w << 16) / info->dst_w;
3094 while (info->dst_h--) {
3096 Uint32 *dst = (Uint32 *)info->dst;
3097 int n = info->dst_w;
3100 while (posy >= 0x10000L) {
3105 if (posx >= 0x10000L) {
3106 while (posx >= 0x10000L) {
3110 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
3113 R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
3114 if (flags & SDL_COPY_MODULATE_COLOR) {
3115 R = (R * modulateR) / 255;
3116 G = (G * modulateG) / 255;
3117 B = (B * modulateB) / 255;
3119 pixel = (B << 16) | (G << 8) | R;
3125 info->dst += info->dst_pitch;
3129 static void SDL_Blit_ARGB8888_BGR888_Modulate_Blend(SDL_BlitInfo *info)
3131 const int flags = info->flags;
3132 const Uint32 modulateR = info->r;
3133 const Uint32 modulateG = info->g;
3134 const Uint32 modulateB = info->b;
3135 const Uint32 modulateA = info->a;
3137 Uint32 srcR, srcG, srcB, srcA;
3139 Uint32 dstR, dstG, dstB;
3141 while (info->dst_h--) {
3142 Uint32 *src = (Uint32 *)info->src;
3143 Uint32 *dst = (Uint32 *)info->dst;
3144 int n = info->dst_w;
3147 srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
3149 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel;
3150 if (flags & SDL_COPY_MODULATE_COLOR) {
3151 srcR = (srcR * modulateR) / 255;
3152 srcG = (srcG * modulateG) / 255;
3153 srcB = (srcB * modulateB) / 255;
3155 if (flags & SDL_COPY_MODULATE_ALPHA) {
3156 srcA = (srcA * modulateA) / 255;
3158 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
3159 /* This goes away if we ever use premultiplied alpha */
3161 srcR = (srcR * srcA) / 255;
3162 srcG = (srcG * srcA) / 255;
3163 srcB = (srcB * srcA) / 255;
3166 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
3167 case SDL_COPY_BLEND:
3168 dstR = srcR + ((255 - srcA) * dstR) / 255;
3169 dstG = srcG + ((255 - srcA) * dstG) / 255;
3170 dstB = srcB + ((255 - srcA) * dstB) / 255;
3173 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
3174 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
3175 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
3178 dstR = (srcR * dstR) / 255;
3179 dstG = (srcG * dstG) / 255;
3180 dstB = (srcB * dstB) / 255;
3183 dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
3184 dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
3185 dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
3188 dstpixel = (dstB << 16) | (dstG << 8) | dstR;
3193 info->src += info->src_pitch;
3194 info->dst += info->dst_pitch;
3198 static void SDL_Blit_ARGB8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info)
3200 const int flags = info->flags;
3201 const Uint32 modulateR = info->r;
3202 const Uint32 modulateG = info->g;
3203 const Uint32 modulateB = info->b;
3204 const Uint32 modulateA = info->a;
3206 Uint32 srcR, srcG, srcB, srcA;
3208 Uint32 dstR, dstG, dstB;
3215 incy = (info->src_h << 16) / info->dst_h;
3216 incx = (info->src_w << 16) / info->dst_w;
3218 while (info->dst_h--) {
3220 Uint32 *dst = (Uint32 *)info->dst;
3221 int n = info->dst_w;
3224 while (posy >= 0x10000L) {
3229 if (posx >= 0x10000L) {
3230 while (posx >= 0x10000L) {
3234 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
3237 srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
3239 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel;
3240 if (flags & SDL_COPY_MODULATE_COLOR) {
3241 srcR = (srcR * modulateR) / 255;
3242 srcG = (srcG * modulateG) / 255;
3243 srcB = (srcB * modulateB) / 255;
3245 if (flags & SDL_COPY_MODULATE_ALPHA) {
3246 srcA = (srcA * modulateA) / 255;
3248 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
3249 /* This goes away if we ever use premultiplied alpha */
3251 srcR = (srcR * srcA) / 255;
3252 srcG = (srcG * srcA) / 255;
3253 srcB = (srcB * srcA) / 255;
3256 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
3257 case SDL_COPY_BLEND:
3258 dstR = srcR + ((255 - srcA) * dstR) / 255;
3259 dstG = srcG + ((255 - srcA) * dstG) / 255;
3260 dstB = srcB + ((255 - srcA) * dstB) / 255;
3263 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
3264 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
3265 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
3268 dstR = (srcR * dstR) / 255;
3269 dstG = (srcG * dstG) / 255;
3270 dstB = (srcB * dstB) / 255;
3273 dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
3274 dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
3275 dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
3278 dstpixel = (dstB << 16) | (dstG << 8) | dstR;
3284 info->dst += info->dst_pitch;
3288 static void SDL_Blit_ARGB8888_ARGB8888_Scale(SDL_BlitInfo *info)
3296 incy = (info->src_h << 16) / info->dst_h;
3297 incx = (info->src_w << 16) / info->dst_w;
3299 while (info->dst_h--) {
3301 Uint32 *dst = (Uint32 *)info->dst;
3302 int n = info->dst_w;
3305 while (posy >= 0x10000L) {
3310 if (posx >= 0x10000L) {
3311 while (posx >= 0x10000L) {
3315 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
3322 info->dst += info->dst_pitch;
3326 static void SDL_Blit_ARGB8888_ARGB8888_Blend(SDL_BlitInfo *info)
3328 const int flags = info->flags;
3330 Uint32 srcR, srcG, srcB, srcA;
3332 Uint32 dstR, dstG, dstB, dstA;
3334 while (info->dst_h--) {
3335 Uint32 *src = (Uint32 *)info->src;
3336 Uint32 *dst = (Uint32 *)info->dst;
3337 int n = info->dst_w;
3340 srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
3342 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
3343 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
3344 /* This goes away if we ever use premultiplied alpha */
3346 srcR = (srcR * srcA) / 255;
3347 srcG = (srcG * srcA) / 255;
3348 srcB = (srcB * srcA) / 255;
3351 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
3352 case SDL_COPY_BLEND:
3353 dstR = srcR + ((255 - srcA) * dstR) / 255;
3354 dstG = srcG + ((255 - srcA) * dstG) / 255;
3355 dstB = srcB + ((255 - srcA) * dstB) / 255;
3356 dstA = srcA + ((255 - srcA) * dstA) / 255;
3359 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
3360 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
3361 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
3364 dstR = (srcR * dstR) / 255;
3365 dstG = (srcG * dstG) / 255;
3366 dstB = (srcB * dstB) / 255;
3369 dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
3370 dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
3371 dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
3372 dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) dstA = 255;
3375 dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB;
3380 info->src += info->src_pitch;
3381 info->dst += info->dst_pitch;
3385 static void SDL_Blit_ARGB8888_ARGB8888_Blend_Scale(SDL_BlitInfo *info)
3387 const int flags = info->flags;
3389 Uint32 srcR, srcG, srcB, srcA;
3391 Uint32 dstR, dstG, dstB, dstA;
3398 incy = (info->src_h << 16) / info->dst_h;
3399 incx = (info->src_w << 16) / info->dst_w;
3401 while (info->dst_h--) {
3403 Uint32 *dst = (Uint32 *)info->dst;
3404 int n = info->dst_w;
3407 while (posy >= 0x10000L) {
3412 if (posx >= 0x10000L) {
3413 while (posx >= 0x10000L) {
3417 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
3420 srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
3422 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
3423 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
3424 /* This goes away if we ever use premultiplied alpha */
3426 srcR = (srcR * srcA) / 255;
3427 srcG = (srcG * srcA) / 255;
3428 srcB = (srcB * srcA) / 255;
3431 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
3432 case SDL_COPY_BLEND:
3433 dstR = srcR + ((255 - srcA) * dstR) / 255;
3434 dstG = srcG + ((255 - srcA) * dstG) / 255;
3435 dstB = srcB + ((255 - srcA) * dstB) / 255;
3436 dstA = srcA + ((255 - srcA) * dstA) / 255;
3439 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
3440 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
3441 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
3444 dstR = (srcR * dstR) / 255;
3445 dstG = (srcG * dstG) / 255;
3446 dstB = (srcB * dstB) / 255;
3449 dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
3450 dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
3451 dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
3452 dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) dstA = 255;
3455 dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB;
3461 info->dst += info->dst_pitch;
3465 static void SDL_Blit_ARGB8888_ARGB8888_Modulate(SDL_BlitInfo *info)
3467 const int flags = info->flags;
3468 const Uint32 modulateR = info->r;
3469 const Uint32 modulateG = info->g;
3470 const Uint32 modulateB = info->b;
3471 const Uint32 modulateA = info->a;
3475 while (info->dst_h--) {
3476 Uint32 *src = (Uint32 *)info->src;
3477 Uint32 *dst = (Uint32 *)info->dst;
3478 int n = info->dst_w;
3481 R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; A = (Uint8)(pixel >> 24);
3482 if (flags & SDL_COPY_MODULATE_COLOR) {
3483 R = (R * modulateR) / 255;
3484 G = (G * modulateG) / 255;
3485 B = (B * modulateB) / 255;
3487 if (flags & SDL_COPY_MODULATE_ALPHA) {
3488 A = (A * modulateA) / 255;
3490 pixel = (A << 24) | (R << 16) | (G << 8) | B;
3495 info->src += info->src_pitch;
3496 info->dst += info->dst_pitch;
3500 static void SDL_Blit_ARGB8888_ARGB8888_Modulate_Scale(SDL_BlitInfo *info)
3502 const int flags = info->flags;
3503 const Uint32 modulateR = info->r;
3504 const Uint32 modulateG = info->g;
3505 const Uint32 modulateB = info->b;
3506 const Uint32 modulateA = info->a;
3515 incy = (info->src_h << 16) / info->dst_h;
3516 incx = (info->src_w << 16) / info->dst_w;
3518 while (info->dst_h--) {
3520 Uint32 *dst = (Uint32 *)info->dst;
3521 int n = info->dst_w;
3524 while (posy >= 0x10000L) {
3529 if (posx >= 0x10000L) {
3530 while (posx >= 0x10000L) {
3534 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
3537 R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; A = (Uint8)(pixel >> 24);
3538 if (flags & SDL_COPY_MODULATE_COLOR) {
3539 R = (R * modulateR) / 255;
3540 G = (G * modulateG) / 255;
3541 B = (B * modulateB) / 255;
3543 if (flags & SDL_COPY_MODULATE_ALPHA) {
3544 A = (A * modulateA) / 255;
3546 pixel = (A << 24) | (R << 16) | (G << 8) | B;
3552 info->dst += info->dst_pitch;
3556 static void SDL_Blit_ARGB8888_ARGB8888_Modulate_Blend(SDL_BlitInfo *info)
3558 const int flags = info->flags;
3559 const Uint32 modulateR = info->r;
3560 const Uint32 modulateG = info->g;
3561 const Uint32 modulateB = info->b;
3562 const Uint32 modulateA = info->a;
3564 Uint32 srcR, srcG, srcB, srcA;
3566 Uint32 dstR, dstG, dstB, dstA;
3568 while (info->dst_h--) {
3569 Uint32 *src = (Uint32 *)info->src;
3570 Uint32 *dst = (Uint32 *)info->dst;
3571 int n = info->dst_w;
3574 srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
3576 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
3577 if (flags & SDL_COPY_MODULATE_COLOR) {
3578 srcR = (srcR * modulateR) / 255;
3579 srcG = (srcG * modulateG) / 255;
3580 srcB = (srcB * modulateB) / 255;
3582 if (flags & SDL_COPY_MODULATE_ALPHA) {
3583 srcA = (srcA * modulateA) / 255;
3585 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
3586 /* This goes away if we ever use premultiplied alpha */
3588 srcR = (srcR * srcA) / 255;
3589 srcG = (srcG * srcA) / 255;
3590 srcB = (srcB * srcA) / 255;
3593 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
3594 case SDL_COPY_BLEND:
3595 dstR = srcR + ((255 - srcA) * dstR) / 255;
3596 dstG = srcG + ((255 - srcA) * dstG) / 255;
3597 dstB = srcB + ((255 - srcA) * dstB) / 255;
3598 dstA = srcA + ((255 - srcA) * dstA) / 255;
3601 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
3602 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
3603 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
3606 dstR = (srcR * dstR) / 255;
3607 dstG = (srcG * dstG) / 255;
3608 dstB = (srcB * dstB) / 255;
3611 dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
3612 dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
3613 dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
3614 dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) dstA = 255;
3617 dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB;
3622 info->src += info->src_pitch;
3623 info->dst += info->dst_pitch;
3627 static void SDL_Blit_ARGB8888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info)
3629 const int flags = info->flags;
3630 const Uint32 modulateR = info->r;
3631 const Uint32 modulateG = info->g;
3632 const Uint32 modulateB = info->b;
3633 const Uint32 modulateA = info->a;
3635 Uint32 srcR, srcG, srcB, srcA;
3637 Uint32 dstR, dstG, dstB, dstA;
3644 incy = (info->src_h << 16) / info->dst_h;
3645 incx = (info->src_w << 16) / info->dst_w;
3647 while (info->dst_h--) {
3649 Uint32 *dst = (Uint32 *)info->dst;
3650 int n = info->dst_w;
3653 while (posy >= 0x10000L) {
3658 if (posx >= 0x10000L) {
3659 while (posx >= 0x10000L) {
3663 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
3666 srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
3668 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
3669 if (flags & SDL_COPY_MODULATE_COLOR) {
3670 srcR = (srcR * modulateR) / 255;
3671 srcG = (srcG * modulateG) / 255;
3672 srcB = (srcB * modulateB) / 255;
3674 if (flags & SDL_COPY_MODULATE_ALPHA) {
3675 srcA = (srcA * modulateA) / 255;
3677 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
3678 /* This goes away if we ever use premultiplied alpha */
3680 srcR = (srcR * srcA) / 255;
3681 srcG = (srcG * srcA) / 255;
3682 srcB = (srcB * srcA) / 255;
3685 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
3686 case SDL_COPY_BLEND:
3687 dstR = srcR + ((255 - srcA) * dstR) / 255;
3688 dstG = srcG + ((255 - srcA) * dstG) / 255;
3689 dstB = srcB + ((255 - srcA) * dstB) / 255;
3690 dstA = srcA + ((255 - srcA) * dstA) / 255;
3693 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
3694 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
3695 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
3698 dstR = (srcR * dstR) / 255;
3699 dstG = (srcG * dstG) / 255;
3700 dstB = (srcB * dstB) / 255;
3703 dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
3704 dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
3705 dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
3706 dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) dstA = 255;
3709 dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB;
3715 info->dst += info->dst_pitch;
3719 static void SDL_Blit_RGBA8888_RGB888_Scale(SDL_BlitInfo *info)
3729 incy = (info->src_h << 16) / info->dst_h;
3730 incx = (info->src_w << 16) / info->dst_w;
3732 while (info->dst_h--) {
3734 Uint32 *dst = (Uint32 *)info->dst;
3735 int n = info->dst_w;
3738 while (posy >= 0x10000L) {
3743 if (posx >= 0x10000L) {
3744 while (posx >= 0x10000L) {
3748 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
3751 R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8);
3752 pixel = (R << 16) | (G << 8) | B;
3758 info->dst += info->dst_pitch;
3762 static void SDL_Blit_RGBA8888_RGB888_Blend(SDL_BlitInfo *info)
3764 const int flags = info->flags;
3766 Uint32 srcR, srcG, srcB, srcA;
3768 Uint32 dstR, dstG, dstB;
3770 while (info->dst_h--) {
3771 Uint32 *src = (Uint32 *)info->src;
3772 Uint32 *dst = (Uint32 *)info->dst;
3773 int n = info->dst_w;
3776 srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
3778 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
3779 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
3780 /* This goes away if we ever use premultiplied alpha */
3782 srcR = (srcR * srcA) / 255;
3783 srcG = (srcG * srcA) / 255;
3784 srcB = (srcB * srcA) / 255;
3787 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
3788 case SDL_COPY_BLEND:
3789 dstR = srcR + ((255 - srcA) * dstR) / 255;
3790 dstG = srcG + ((255 - srcA) * dstG) / 255;
3791 dstB = srcB + ((255 - srcA) * dstB) / 255;
3794 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
3795 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
3796 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
3799 dstR = (srcR * dstR) / 255;
3800 dstG = (srcG * dstG) / 255;
3801 dstB = (srcB * dstB) / 255;
3804 dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
3805 dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
3806 dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
3809 dstpixel = (dstR << 16) | (dstG << 8) | dstB;
3814 info->src += info->src_pitch;
3815 info->dst += info->dst_pitch;
3819 static void SDL_Blit_RGBA8888_RGB888_Blend_Scale(SDL_BlitInfo *info)
3821 const int flags = info->flags;
3823 Uint32 srcR, srcG, srcB, srcA;
3825 Uint32 dstR, dstG, dstB;
3832 incy = (info->src_h << 16) / info->dst_h;
3833 incx = (info->src_w << 16) / info->dst_w;
3835 while (info->dst_h--) {
3837 Uint32 *dst = (Uint32 *)info->dst;
3838 int n = info->dst_w;
3841 while (posy >= 0x10000L) {
3846 if (posx >= 0x10000L) {
3847 while (posx >= 0x10000L) {
3851 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
3854 srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
3856 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
3857 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
3858 /* This goes away if we ever use premultiplied alpha */
3860 srcR = (srcR * srcA) / 255;
3861 srcG = (srcG * srcA) / 255;
3862 srcB = (srcB * srcA) / 255;
3865 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
3866 case SDL_COPY_BLEND:
3867 dstR = srcR + ((255 - srcA) * dstR) / 255;
3868 dstG = srcG + ((255 - srcA) * dstG) / 255;
3869 dstB = srcB + ((255 - srcA) * dstB) / 255;
3872 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
3873 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
3874 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
3877 dstR = (srcR * dstR) / 255;
3878 dstG = (srcG * dstG) / 255;
3879 dstB = (srcB * dstB) / 255;
3882 dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
3883 dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
3884 dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
3887 dstpixel = (dstR << 16) | (dstG << 8) | dstB;
3893 info->dst += info->dst_pitch;
3897 static void SDL_Blit_RGBA8888_RGB888_Modulate(SDL_BlitInfo *info)
3899 const int flags = info->flags;
3900 const Uint32 modulateR = info->r;
3901 const Uint32 modulateG = info->g;
3902 const Uint32 modulateB = info->b;
3906 while (info->dst_h--) {
3907 Uint32 *src = (Uint32 *)info->src;
3908 Uint32 *dst = (Uint32 *)info->dst;
3909 int n = info->dst_w;
3912 R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8);
3913 if (flags & SDL_COPY_MODULATE_COLOR) {
3914 R = (R * modulateR) / 255;
3915 G = (G * modulateG) / 255;
3916 B = (B * modulateB) / 255;
3918 pixel = (R << 16) | (G << 8) | B;
3923 info->src += info->src_pitch;
3924 info->dst += info->dst_pitch;
3928 static void SDL_Blit_RGBA8888_RGB888_Modulate_Scale(SDL_BlitInfo *info)
3930 const int flags = info->flags;
3931 const Uint32 modulateR = info->r;
3932 const Uint32 modulateG = info->g;
3933 const Uint32 modulateB = info->b;
3942 incy = (info->src_h << 16) / info->dst_h;
3943 incx = (info->src_w << 16) / info->dst_w;
3945 while (info->dst_h--) {
3947 Uint32 *dst = (Uint32 *)info->dst;
3948 int n = info->dst_w;
3951 while (posy >= 0x10000L) {
3956 if (posx >= 0x10000L) {
3957 while (posx >= 0x10000L) {
3961 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
3964 R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8);
3965 if (flags & SDL_COPY_MODULATE_COLOR) {
3966 R = (R * modulateR) / 255;
3967 G = (G * modulateG) / 255;
3968 B = (B * modulateB) / 255;
3970 pixel = (R << 16) | (G << 8) | B;
3976 info->dst += info->dst_pitch;
3980 static void SDL_Blit_RGBA8888_RGB888_Modulate_Blend(SDL_BlitInfo *info)
3982 const int flags = info->flags;
3983 const Uint32 modulateR = info->r;
3984 const Uint32 modulateG = info->g;
3985 const Uint32 modulateB = info->b;
3986 const Uint32 modulateA = info->a;
3988 Uint32 srcR, srcG, srcB, srcA;
3990 Uint32 dstR, dstG, dstB;
3992 while (info->dst_h--) {
3993 Uint32 *src = (Uint32 *)info->src;
3994 Uint32 *dst = (Uint32 *)info->dst;
3995 int n = info->dst_w;
3998 srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
4000 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
4001 if (flags & SDL_COPY_MODULATE_COLOR) {
4002 srcR = (srcR * modulateR) / 255;
4003 srcG = (srcG * modulateG) / 255;
4004 srcB = (srcB * modulateB) / 255;
4006 if (flags & SDL_COPY_MODULATE_ALPHA) {
4007 srcA = (srcA * modulateA) / 255;
4009 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
4010 /* This goes away if we ever use premultiplied alpha */
4012 srcR = (srcR * srcA) / 255;
4013 srcG = (srcG * srcA) / 255;
4014 srcB = (srcB * srcA) / 255;
4017 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
4018 case SDL_COPY_BLEND:
4019 dstR = srcR + ((255 - srcA) * dstR) / 255;
4020 dstG = srcG + ((255 - srcA) * dstG) / 255;
4021 dstB = srcB + ((255 - srcA) * dstB) / 255;
4024 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
4025 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
4026 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
4029 dstR = (srcR * dstR) / 255;
4030 dstG = (srcG * dstG) / 255;
4031 dstB = (srcB * dstB) / 255;
4034 dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
4035 dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
4036 dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
4039 dstpixel = (dstR << 16) | (dstG << 8) | dstB;
4044 info->src += info->src_pitch;
4045 info->dst += info->dst_pitch;
4049 static void SDL_Blit_RGBA8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info)
4051 const int flags = info->flags;
4052 const Uint32 modulateR = info->r;
4053 const Uint32 modulateG = info->g;
4054 const Uint32 modulateB = info->b;
4055 const Uint32 modulateA = info->a;
4057 Uint32 srcR, srcG, srcB, srcA;
4059 Uint32 dstR, dstG, dstB;
4066 incy = (info->src_h << 16) / info->dst_h;
4067 incx = (info->src_w << 16) / info->dst_w;
4069 while (info->dst_h--) {
4071 Uint32 *dst = (Uint32 *)info->dst;
4072 int n = info->dst_w;
4075 while (posy >= 0x10000L) {
4080 if (posx >= 0x10000L) {
4081 while (posx >= 0x10000L) {
4085 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
4088 srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
4090 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
4091 if (flags & SDL_COPY_MODULATE_COLOR) {
4092 srcR = (srcR * modulateR) / 255;
4093 srcG = (srcG * modulateG) / 255;
4094 srcB = (srcB * modulateB) / 255;
4096 if (flags & SDL_COPY_MODULATE_ALPHA) {
4097 srcA = (srcA * modulateA) / 255;
4099 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
4100 /* This goes away if we ever use premultiplied alpha */
4102 srcR = (srcR * srcA) / 255;
4103 srcG = (srcG * srcA) / 255;
4104 srcB = (srcB * srcA) / 255;
4107 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
4108 case SDL_COPY_BLEND:
4109 dstR = srcR + ((255 - srcA) * dstR) / 255;
4110 dstG = srcG + ((255 - srcA) * dstG) / 255;
4111 dstB = srcB + ((255 - srcA) * dstB) / 255;
4114 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
4115 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
4116 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
4119 dstR = (srcR * dstR) / 255;
4120 dstG = (srcG * dstG) / 255;
4121 dstB = (srcB * dstB) / 255;
4124 dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
4125 dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
4126 dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
4129 dstpixel = (dstR << 16) | (dstG << 8) | dstB;
4135 info->dst += info->dst_pitch;
4139 static void SDL_Blit_RGBA8888_BGR888_Scale(SDL_BlitInfo *info)
4149 incy = (info->src_h << 16) / info->dst_h;
4150 incx = (info->src_w << 16) / info->dst_w;
4152 while (info->dst_h--) {
4154 Uint32 *dst = (Uint32 *)info->dst;
4155 int n = info->dst_w;
4158 while (posy >= 0x10000L) {
4163 if (posx >= 0x10000L) {
4164 while (posx >= 0x10000L) {
4168 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
4171 R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8);
4172 pixel = (B << 16) | (G << 8) | R;
4178 info->dst += info->dst_pitch;
4182 static void SDL_Blit_RGBA8888_BGR888_Blend(SDL_BlitInfo *info)
4184 const int flags = info->flags;
4186 Uint32 srcR, srcG, srcB, srcA;
4188 Uint32 dstR, dstG, dstB;
4190 while (info->dst_h--) {
4191 Uint32 *src = (Uint32 *)info->src;
4192 Uint32 *dst = (Uint32 *)info->dst;
4193 int n = info->dst_w;
4196 srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
4198 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel;
4199 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
4200 /* This goes away if we ever use premultiplied alpha */
4202 srcR = (srcR * srcA) / 255;
4203 srcG = (srcG * srcA) / 255;
4204 srcB = (srcB * srcA) / 255;
4207 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
4208 case SDL_COPY_BLEND:
4209 dstR = srcR + ((255 - srcA) * dstR) / 255;
4210 dstG = srcG + ((255 - srcA) * dstG) / 255;
4211 dstB = srcB + ((255 - srcA) * dstB) / 255;
4214 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
4215 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
4216 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
4219 dstR = (srcR * dstR) / 255;
4220 dstG = (srcG * dstG) / 255;
4221 dstB = (srcB * dstB) / 255;
4224 dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
4225 dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
4226 dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
4229 dstpixel = (dstB << 16) | (dstG << 8) | dstR;
4234 info->src += info->src_pitch;
4235 info->dst += info->dst_pitch;
4239 static void SDL_Blit_RGBA8888_BGR888_Blend_Scale(SDL_BlitInfo *info)
4241 const int flags = info->flags;
4243 Uint32 srcR, srcG, srcB, srcA;
4245 Uint32 dstR, dstG, dstB;
4252 incy = (info->src_h << 16) / info->dst_h;
4253 incx = (info->src_w << 16) / info->dst_w;
4255 while (info->dst_h--) {
4257 Uint32 *dst = (Uint32 *)info->dst;
4258 int n = info->dst_w;
4261 while (posy >= 0x10000L) {
4266 if (posx >= 0x10000L) {
4267 while (posx >= 0x10000L) {
4271 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
4274 srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
4276 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel;
4277 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
4278 /* This goes away if we ever use premultiplied alpha */
4280 srcR = (srcR * srcA) / 255;
4281 srcG = (srcG * srcA) / 255;
4282 srcB = (srcB * srcA) / 255;
4285 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
4286 case SDL_COPY_BLEND:
4287 dstR = srcR + ((255 - srcA) * dstR) / 255;
4288 dstG = srcG + ((255 - srcA) * dstG) / 255;
4289 dstB = srcB + ((255 - srcA) * dstB) / 255;
4292 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
4293 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
4294 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
4297 dstR = (srcR * dstR) / 255;
4298 dstG = (srcG * dstG) / 255;
4299 dstB = (srcB * dstB) / 255;
4302 dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
4303 dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
4304 dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
4307 dstpixel = (dstB << 16) | (dstG << 8) | dstR;
4313 info->dst += info->dst_pitch;
4317 static void SDL_Blit_RGBA8888_BGR888_Modulate(SDL_BlitInfo *info)
4319 const int flags = info->flags;
4320 const Uint32 modulateR = info->r;
4321 const Uint32 modulateG = info->g;
4322 const Uint32 modulateB = info->b;
4326 while (info->dst_h--) {
4327 Uint32 *src = (Uint32 *)info->src;
4328 Uint32 *dst = (Uint32 *)info->dst;
4329 int n = info->dst_w;
4332 R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8);
4333 if (flags & SDL_COPY_MODULATE_COLOR) {
4334 R = (R * modulateR) / 255;
4335 G = (G * modulateG) / 255;
4336 B = (B * modulateB) / 255;
4338 pixel = (B << 16) | (G << 8) | R;
4343 info->src += info->src_pitch;
4344 info->dst += info->dst_pitch;
4348 static void SDL_Blit_RGBA8888_BGR888_Modulate_Scale(SDL_BlitInfo *info)
4350 const int flags = info->flags;
4351 const Uint32 modulateR = info->r;
4352 const Uint32 modulateG = info->g;
4353 const Uint32 modulateB = info->b;
4362 incy = (info->src_h << 16) / info->dst_h;
4363 incx = (info->src_w << 16) / info->dst_w;
4365 while (info->dst_h--) {
4367 Uint32 *dst = (Uint32 *)info->dst;
4368 int n = info->dst_w;
4371 while (posy >= 0x10000L) {
4376 if (posx >= 0x10000L) {
4377 while (posx >= 0x10000L) {
4381 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
4384 R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8);
4385 if (flags & SDL_COPY_MODULATE_COLOR) {
4386 R = (R * modulateR) / 255;
4387 G = (G * modulateG) / 255;
4388 B = (B * modulateB) / 255;
4390 pixel = (B << 16) | (G << 8) | R;
4396 info->dst += info->dst_pitch;
4400 static void SDL_Blit_RGBA8888_BGR888_Modulate_Blend(SDL_BlitInfo *info)
4402 const int flags = info->flags;
4403 const Uint32 modulateR = info->r;
4404 const Uint32 modulateG = info->g;
4405 const Uint32 modulateB = info->b;
4406 const Uint32 modulateA = info->a;
4408 Uint32 srcR, srcG, srcB, srcA;
4410 Uint32 dstR, dstG, dstB;
4412 while (info->dst_h--) {
4413 Uint32 *src = (Uint32 *)info->src;
4414 Uint32 *dst = (Uint32 *)info->dst;
4415 int n = info->dst_w;
4418 srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
4420 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel;
4421 if (flags & SDL_COPY_MODULATE_COLOR) {
4422 srcR = (srcR * modulateR) / 255;
4423 srcG = (srcG * modulateG) / 255;
4424 srcB = (srcB * modulateB) / 255;
4426 if (flags & SDL_COPY_MODULATE_ALPHA) {
4427 srcA = (srcA * modulateA) / 255;
4429 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
4430 /* This goes away if we ever use premultiplied alpha */
4432 srcR = (srcR * srcA) / 255;
4433 srcG = (srcG * srcA) / 255;
4434 srcB = (srcB * srcA) / 255;
4437 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
4438 case SDL_COPY_BLEND:
4439 dstR = srcR + ((255 - srcA) * dstR) / 255;
4440 dstG = srcG + ((255 - srcA) * dstG) / 255;
4441 dstB = srcB + ((255 - srcA) * dstB) / 255;
4444 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
4445 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
4446 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
4449 dstR = (srcR * dstR) / 255;
4450 dstG = (srcG * dstG) / 255;
4451 dstB = (srcB * dstB) / 255;
4454 dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
4455 dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
4456 dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
4459 dstpixel = (dstB << 16) | (dstG << 8) | dstR;
4464 info->src += info->src_pitch;
4465 info->dst += info->dst_pitch;
4469 static void SDL_Blit_RGBA8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info)
4471 const int flags = info->flags;
4472 const Uint32 modulateR = info->r;
4473 const Uint32 modulateG = info->g;
4474 const Uint32 modulateB = info->b;
4475 const Uint32 modulateA = info->a;
4477 Uint32 srcR, srcG, srcB, srcA;
4479 Uint32 dstR, dstG, dstB;
4486 incy = (info->src_h << 16) / info->dst_h;
4487 incx = (info->src_w << 16) / info->dst_w;
4489 while (info->dst_h--) {
4491 Uint32 *dst = (Uint32 *)info->dst;
4492 int n = info->dst_w;
4495 while (posy >= 0x10000L) {
4500 if (posx >= 0x10000L) {
4501 while (posx >= 0x10000L) {
4505 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
4508 srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
4510 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel;
4511 if (flags & SDL_COPY_MODULATE_COLOR) {
4512 srcR = (srcR * modulateR) / 255;
4513 srcG = (srcG * modulateG) / 255;
4514 srcB = (srcB * modulateB) / 255;
4516 if (flags & SDL_COPY_MODULATE_ALPHA) {
4517 srcA = (srcA * modulateA) / 255;
4519 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
4520 /* This goes away if we ever use premultiplied alpha */
4522 srcR = (srcR * srcA) / 255;
4523 srcG = (srcG * srcA) / 255;
4524 srcB = (srcB * srcA) / 255;
4527 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
4528 case SDL_COPY_BLEND:
4529 dstR = srcR + ((255 - srcA) * dstR) / 255;
4530 dstG = srcG + ((255 - srcA) * dstG) / 255;
4531 dstB = srcB + ((255 - srcA) * dstB) / 255;
4534 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
4535 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
4536 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
4539 dstR = (srcR * dstR) / 255;
4540 dstG = (srcG * dstG) / 255;
4541 dstB = (srcB * dstB) / 255;
4544 dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
4545 dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
4546 dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
4549 dstpixel = (dstB << 16) | (dstG << 8) | dstR;
4555 info->dst += info->dst_pitch;
4559 static void SDL_Blit_RGBA8888_ARGB8888_Scale(SDL_BlitInfo *info)
4569 incy = (info->src_h << 16) / info->dst_h;
4570 incx = (info->src_w << 16) / info->dst_w;
4572 while (info->dst_h--) {
4574 Uint32 *dst = (Uint32 *)info->dst;
4575 int n = info->dst_w;
4578 while (posy >= 0x10000L) {
4583 if (posx >= 0x10000L) {
4584 while (posx >= 0x10000L) {
4588 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
4591 R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel;
4592 pixel = (A << 24) | (R << 16) | (G << 8) | B;
4598 info->dst += info->dst_pitch;
4602 static void SDL_Blit_RGBA8888_ARGB8888_Blend(SDL_BlitInfo *info)
4604 const int flags = info->flags;
4606 Uint32 srcR, srcG, srcB, srcA;
4608 Uint32 dstR, dstG, dstB, dstA;
4610 while (info->dst_h--) {
4611 Uint32 *src = (Uint32 *)info->src;
4612 Uint32 *dst = (Uint32 *)info->dst;
4613 int n = info->dst_w;
4616 srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
4618 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
4619 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
4620 /* This goes away if we ever use premultiplied alpha */
4622 srcR = (srcR * srcA) / 255;
4623 srcG = (srcG * srcA) / 255;
4624 srcB = (srcB * srcA) / 255;
4627 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
4628 case SDL_COPY_BLEND:
4629 dstR = srcR + ((255 - srcA) * dstR) / 255;
4630 dstG = srcG + ((255 - srcA) * dstG) / 255;
4631 dstB = srcB + ((255 - srcA) * dstB) / 255;
4632 dstA = srcA + ((255 - srcA) * dstA) / 255;
4635 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
4636 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
4637 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
4640 dstR = (srcR * dstR) / 255;
4641 dstG = (srcG * dstG) / 255;
4642 dstB = (srcB * dstB) / 255;
4645 dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
4646 dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
4647 dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
4648 dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) dstA = 255;
4651 dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB;
4656 info->src += info->src_pitch;
4657 info->dst += info->dst_pitch;
4661 static void SDL_Blit_RGBA8888_ARGB8888_Blend_Scale(SDL_BlitInfo *info)
4663 const int flags = info->flags;
4665 Uint32 srcR, srcG, srcB, srcA;
4667 Uint32 dstR, dstG, dstB, dstA;
4674 incy = (info->src_h << 16) / info->dst_h;
4675 incx = (info->src_w << 16) / info->dst_w;
4677 while (info->dst_h--) {
4679 Uint32 *dst = (Uint32 *)info->dst;
4680 int n = info->dst_w;
4683 while (posy >= 0x10000L) {
4688 if (posx >= 0x10000L) {
4689 while (posx >= 0x10000L) {
4693 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
4696 srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
4698 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
4699 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
4700 /* This goes away if we ever use premultiplied alpha */
4702 srcR = (srcR * srcA) / 255;
4703 srcG = (srcG * srcA) / 255;
4704 srcB = (srcB * srcA) / 255;
4707 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
4708 case SDL_COPY_BLEND:
4709 dstR = srcR + ((255 - srcA) * dstR) / 255;
4710 dstG = srcG + ((255 - srcA) * dstG) / 255;
4711 dstB = srcB + ((255 - srcA) * dstB) / 255;
4712 dstA = srcA + ((255 - srcA) * dstA) / 255;
4715 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
4716 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
4717 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
4720 dstR = (srcR * dstR) / 255;
4721 dstG = (srcG * dstG) / 255;
4722 dstB = (srcB * dstB) / 255;
4725 dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
4726 dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
4727 dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
4728 dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) dstA = 255;
4731 dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB;
4737 info->dst += info->dst_pitch;
4741 static void SDL_Blit_RGBA8888_ARGB8888_Modulate(SDL_BlitInfo *info)
4743 const int flags = info->flags;
4744 const Uint32 modulateR = info->r;
4745 const Uint32 modulateG = info->g;
4746 const Uint32 modulateB = info->b;
4747 const Uint32 modulateA = info->a;
4751 while (info->dst_h--) {
4752 Uint32 *src = (Uint32 *)info->src;
4753 Uint32 *dst = (Uint32 *)info->dst;
4754 int n = info->dst_w;
4757 R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel;
4758 if (flags & SDL_COPY_MODULATE_COLOR) {
4759 R = (R * modulateR) / 255;
4760 G = (G * modulateG) / 255;
4761 B = (B * modulateB) / 255;
4763 if (flags & SDL_COPY_MODULATE_ALPHA) {
4764 A = (A * modulateA) / 255;
4766 pixel = (A << 24) | (R << 16) | (G << 8) | B;
4771 info->src += info->src_pitch;
4772 info->dst += info->dst_pitch;
4776 static void SDL_Blit_RGBA8888_ARGB8888_Modulate_Scale(SDL_BlitInfo *info)
4778 const int flags = info->flags;
4779 const Uint32 modulateR = info->r;
4780 const Uint32 modulateG = info->g;
4781 const Uint32 modulateB = info->b;
4782 const Uint32 modulateA = info->a;
4791 incy = (info->src_h << 16) / info->dst_h;
4792 incx = (info->src_w << 16) / info->dst_w;
4794 while (info->dst_h--) {
4796 Uint32 *dst = (Uint32 *)info->dst;
4797 int n = info->dst_w;
4800 while (posy >= 0x10000L) {
4805 if (posx >= 0x10000L) {
4806 while (posx >= 0x10000L) {
4810 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
4813 R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel;
4814 if (flags & SDL_COPY_MODULATE_COLOR) {
4815 R = (R * modulateR) / 255;
4816 G = (G * modulateG) / 255;
4817 B = (B * modulateB) / 255;
4819 if (flags & SDL_COPY_MODULATE_ALPHA) {
4820 A = (A * modulateA) / 255;
4822 pixel = (A << 24) | (R << 16) | (G << 8) | B;
4828 info->dst += info->dst_pitch;
4832 static void SDL_Blit_RGBA8888_ARGB8888_Modulate_Blend(SDL_BlitInfo *info)
4834 const int flags = info->flags;
4835 const Uint32 modulateR = info->r;
4836 const Uint32 modulateG = info->g;
4837 const Uint32 modulateB = info->b;
4838 const Uint32 modulateA = info->a;
4840 Uint32 srcR, srcG, srcB, srcA;
4842 Uint32 dstR, dstG, dstB, dstA;
4844 while (info->dst_h--) {
4845 Uint32 *src = (Uint32 *)info->src;
4846 Uint32 *dst = (Uint32 *)info->dst;
4847 int n = info->dst_w;
4850 srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
4852 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
4853 if (flags & SDL_COPY_MODULATE_COLOR) {
4854 srcR = (srcR * modulateR) / 255;
4855 srcG = (srcG * modulateG) / 255;
4856 srcB = (srcB * modulateB) / 255;
4858 if (flags & SDL_COPY_MODULATE_ALPHA) {
4859 srcA = (srcA * modulateA) / 255;
4861 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
4862 /* This goes away if we ever use premultiplied alpha */
4864 srcR = (srcR * srcA) / 255;
4865 srcG = (srcG * srcA) / 255;
4866 srcB = (srcB * srcA) / 255;
4869 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
4870 case SDL_COPY_BLEND:
4871 dstR = srcR + ((255 - srcA) * dstR) / 255;
4872 dstG = srcG + ((255 - srcA) * dstG) / 255;
4873 dstB = srcB + ((255 - srcA) * dstB) / 255;
4874 dstA = srcA + ((255 - srcA) * dstA) / 255;
4877 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
4878 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
4879 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
4882 dstR = (srcR * dstR) / 255;
4883 dstG = (srcG * dstG) / 255;
4884 dstB = (srcB * dstB) / 255;
4887 dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
4888 dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
4889 dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
4890 dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) dstA = 255;
4893 dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB;
4898 info->src += info->src_pitch;
4899 info->dst += info->dst_pitch;
4903 static void SDL_Blit_RGBA8888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info)
4905 const int flags = info->flags;
4906 const Uint32 modulateR = info->r;
4907 const Uint32 modulateG = info->g;
4908 const Uint32 modulateB = info->b;
4909 const Uint32 modulateA = info->a;
4911 Uint32 srcR, srcG, srcB, srcA;
4913 Uint32 dstR, dstG, dstB, dstA;
4920 incy = (info->src_h << 16) / info->dst_h;
4921 incx = (info->src_w << 16) / info->dst_w;
4923 while (info->dst_h--) {
4925 Uint32 *dst = (Uint32 *)info->dst;
4926 int n = info->dst_w;
4929 while (posy >= 0x10000L) {
4934 if (posx >= 0x10000L) {
4935 while (posx >= 0x10000L) {
4939 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
4942 srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
4944 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
4945 if (flags & SDL_COPY_MODULATE_COLOR) {
4946 srcR = (srcR * modulateR) / 255;
4947 srcG = (srcG * modulateG) / 255;
4948 srcB = (srcB * modulateB) / 255;
4950 if (flags & SDL_COPY_MODULATE_ALPHA) {
4951 srcA = (srcA * modulateA) / 255;
4953 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
4954 /* This goes away if we ever use premultiplied alpha */
4956 srcR = (srcR * srcA) / 255;
4957 srcG = (srcG * srcA) / 255;
4958 srcB = (srcB * srcA) / 255;
4961 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
4962 case SDL_COPY_BLEND:
4963 dstR = srcR + ((255 - srcA) * dstR) / 255;
4964 dstG = srcG + ((255 - srcA) * dstG) / 255;
4965 dstB = srcB + ((255 - srcA) * dstB) / 255;
4966 dstA = srcA + ((255 - srcA) * dstA) / 255;
4969 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
4970 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
4971 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
4974 dstR = (srcR * dstR) / 255;
4975 dstG = (srcG * dstG) / 255;
4976 dstB = (srcB * dstB) / 255;
4979 dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
4980 dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
4981 dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
4982 dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) dstA = 255;
4985 dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB;
4991 info->dst += info->dst_pitch;
4995 static void SDL_Blit_ABGR8888_RGB888_Scale(SDL_BlitInfo *info)
5005 incy = (info->src_h << 16) / info->dst_h;
5006 incx = (info->src_w << 16) / info->dst_w;
5008 while (info->dst_h--) {
5010 Uint32 *dst = (Uint32 *)info->dst;
5011 int n = info->dst_w;
5014 while (posy >= 0x10000L) {
5019 if (posx >= 0x10000L) {
5020 while (posx >= 0x10000L) {
5024 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
5027 B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
5028 pixel = (R << 16) | (G << 8) | B;
5034 info->dst += info->dst_pitch;
5038 static void SDL_Blit_ABGR8888_RGB888_Blend(SDL_BlitInfo *info)
5040 const int flags = info->flags;
5042 Uint32 srcR, srcG, srcB, srcA;
5044 Uint32 dstR, dstG, dstB;
5046 while (info->dst_h--) {
5047 Uint32 *src = (Uint32 *)info->src;
5048 Uint32 *dst = (Uint32 *)info->dst;
5049 int n = info->dst_w;
5052 srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
5054 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
5055 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
5056 /* This goes away if we ever use premultiplied alpha */
5058 srcR = (srcR * srcA) / 255;
5059 srcG = (srcG * srcA) / 255;
5060 srcB = (srcB * srcA) / 255;
5063 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
5064 case SDL_COPY_BLEND:
5065 dstR = srcR + ((255 - srcA) * dstR) / 255;
5066 dstG = srcG + ((255 - srcA) * dstG) / 255;
5067 dstB = srcB + ((255 - srcA) * dstB) / 255;
5070 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
5071 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
5072 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
5075 dstR = (srcR * dstR) / 255;
5076 dstG = (srcG * dstG) / 255;
5077 dstB = (srcB * dstB) / 255;
5080 dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
5081 dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
5082 dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
5085 dstpixel = (dstR << 16) | (dstG << 8) | dstB;
5090 info->src += info->src_pitch;
5091 info->dst += info->dst_pitch;
5095 static void SDL_Blit_ABGR8888_RGB888_Blend_Scale(SDL_BlitInfo *info)
5097 const int flags = info->flags;
5099 Uint32 srcR, srcG, srcB, srcA;
5101 Uint32 dstR, dstG, dstB;
5108 incy = (info->src_h << 16) / info->dst_h;
5109 incx = (info->src_w << 16) / info->dst_w;
5111 while (info->dst_h--) {
5113 Uint32 *dst = (Uint32 *)info->dst;
5114 int n = info->dst_w;
5117 while (posy >= 0x10000L) {
5122 if (posx >= 0x10000L) {
5123 while (posx >= 0x10000L) {
5127 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
5130 srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
5132 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
5133 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
5134 /* This goes away if we ever use premultiplied alpha */
5136 srcR = (srcR * srcA) / 255;
5137 srcG = (srcG * srcA) / 255;
5138 srcB = (srcB * srcA) / 255;
5141 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
5142 case SDL_COPY_BLEND:
5143 dstR = srcR + ((255 - srcA) * dstR) / 255;
5144 dstG = srcG + ((255 - srcA) * dstG) / 255;
5145 dstB = srcB + ((255 - srcA) * dstB) / 255;
5148 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
5149 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
5150 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
5153 dstR = (srcR * dstR) / 255;
5154 dstG = (srcG * dstG) / 255;
5155 dstB = (srcB * dstB) / 255;
5158 dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
5159 dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
5160 dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
5163 dstpixel = (dstR << 16) | (dstG << 8) | dstB;
5169 info->dst += info->dst_pitch;
5173 static void SDL_Blit_ABGR8888_RGB888_Modulate(SDL_BlitInfo *info)
5175 const int flags = info->flags;
5176 const Uint32 modulateR = info->r;
5177 const Uint32 modulateG = info->g;
5178 const Uint32 modulateB = info->b;
5182 while (info->dst_h--) {
5183 Uint32 *src = (Uint32 *)info->src;
5184 Uint32 *dst = (Uint32 *)info->dst;
5185 int n = info->dst_w;
5188 B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
5189 if (flags & SDL_COPY_MODULATE_COLOR) {
5190 R = (R * modulateR) / 255;
5191 G = (G * modulateG) / 255;
5192 B = (B * modulateB) / 255;
5194 pixel = (R << 16) | (G << 8) | B;
5199 info->src += info->src_pitch;
5200 info->dst += info->dst_pitch;
5204 static void SDL_Blit_ABGR8888_RGB888_Modulate_Scale(SDL_BlitInfo *info)
5206 const int flags = info->flags;
5207 const Uint32 modulateR = info->r;
5208 const Uint32 modulateG = info->g;
5209 const Uint32 modulateB = info->b;
5218 incy = (info->src_h << 16) / info->dst_h;
5219 incx = (info->src_w << 16) / info->dst_w;
5221 while (info->dst_h--) {
5223 Uint32 *dst = (Uint32 *)info->dst;
5224 int n = info->dst_w;
5227 while (posy >= 0x10000L) {
5232 if (posx >= 0x10000L) {
5233 while (posx >= 0x10000L) {
5237 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
5240 B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
5241 if (flags & SDL_COPY_MODULATE_COLOR) {
5242 R = (R * modulateR) / 255;
5243 G = (G * modulateG) / 255;
5244 B = (B * modulateB) / 255;
5246 pixel = (R << 16) | (G << 8) | B;
5252 info->dst += info->dst_pitch;
5256 static void SDL_Blit_ABGR8888_RGB888_Modulate_Blend(SDL_BlitInfo *info)
5258 const int flags = info->flags;
5259 const Uint32 modulateR = info->r;
5260 const Uint32 modulateG = info->g;
5261 const Uint32 modulateB = info->b;
5262 const Uint32 modulateA = info->a;
5264 Uint32 srcR, srcG, srcB, srcA;
5266 Uint32 dstR, dstG, dstB;
5268 while (info->dst_h--) {
5269 Uint32 *src = (Uint32 *)info->src;
5270 Uint32 *dst = (Uint32 *)info->dst;
5271 int n = info->dst_w;
5274 srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
5276 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
5277 if (flags & SDL_COPY_MODULATE_COLOR) {
5278 srcR = (srcR * modulateR) / 255;
5279 srcG = (srcG * modulateG) / 255;
5280 srcB = (srcB * modulateB) / 255;
5282 if (flags & SDL_COPY_MODULATE_ALPHA) {
5283 srcA = (srcA * modulateA) / 255;
5285 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
5286 /* This goes away if we ever use premultiplied alpha */
5288 srcR = (srcR * srcA) / 255;
5289 srcG = (srcG * srcA) / 255;
5290 srcB = (srcB * srcA) / 255;
5293 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
5294 case SDL_COPY_BLEND:
5295 dstR = srcR + ((255 - srcA) * dstR) / 255;
5296 dstG = srcG + ((255 - srcA) * dstG) / 255;
5297 dstB = srcB + ((255 - srcA) * dstB) / 255;
5300 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
5301 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
5302 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
5305 dstR = (srcR * dstR) / 255;
5306 dstG = (srcG * dstG) / 255;
5307 dstB = (srcB * dstB) / 255;
5310 dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
5311 dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
5312 dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
5315 dstpixel = (dstR << 16) | (dstG << 8) | dstB;
5320 info->src += info->src_pitch;
5321 info->dst += info->dst_pitch;
5325 static void SDL_Blit_ABGR8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info)
5327 const int flags = info->flags;
5328 const Uint32 modulateR = info->r;
5329 const Uint32 modulateG = info->g;
5330 const Uint32 modulateB = info->b;
5331 const Uint32 modulateA = info->a;
5333 Uint32 srcR, srcG, srcB, srcA;
5335 Uint32 dstR, dstG, dstB;
5342 incy = (info->src_h << 16) / info->dst_h;
5343 incx = (info->src_w << 16) / info->dst_w;
5345 while (info->dst_h--) {
5347 Uint32 *dst = (Uint32 *)info->dst;
5348 int n = info->dst_w;
5351 while (posy >= 0x10000L) {
5356 if (posx >= 0x10000L) {
5357 while (posx >= 0x10000L) {
5361 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
5364 srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
5366 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
5367 if (flags & SDL_COPY_MODULATE_COLOR) {
5368 srcR = (srcR * modulateR) / 255;
5369 srcG = (srcG * modulateG) / 255;
5370 srcB = (srcB * modulateB) / 255;
5372 if (flags & SDL_COPY_MODULATE_ALPHA) {
5373 srcA = (srcA * modulateA) / 255;
5375 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
5376 /* This goes away if we ever use premultiplied alpha */
5378 srcR = (srcR * srcA) / 255;
5379 srcG = (srcG * srcA) / 255;
5380 srcB = (srcB * srcA) / 255;
5383 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
5384 case SDL_COPY_BLEND:
5385 dstR = srcR + ((255 - srcA) * dstR) / 255;
5386 dstG = srcG + ((255 - srcA) * dstG) / 255;
5387 dstB = srcB + ((255 - srcA) * dstB) / 255;
5390 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
5391 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
5392 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
5395 dstR = (srcR * dstR) / 255;
5396 dstG = (srcG * dstG) / 255;
5397 dstB = (srcB * dstB) / 255;
5400 dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
5401 dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
5402 dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
5405 dstpixel = (dstR << 16) | (dstG << 8) | dstB;
5411 info->dst += info->dst_pitch;
5415 static void SDL_Blit_ABGR8888_BGR888_Scale(SDL_BlitInfo *info)
5425 incy = (info->src_h << 16) / info->dst_h;
5426 incx = (info->src_w << 16) / info->dst_w;
5428 while (info->dst_h--) {
5430 Uint32 *dst = (Uint32 *)info->dst;
5431 int n = info->dst_w;
5434 while (posy >= 0x10000L) {
5439 if (posx >= 0x10000L) {
5440 while (posx >= 0x10000L) {
5444 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
5447 B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
5448 pixel = (B << 16) | (G << 8) | R;
5454 info->dst += info->dst_pitch;
5458 static void SDL_Blit_ABGR8888_BGR888_Blend(SDL_BlitInfo *info)
5460 const int flags = info->flags;
5462 Uint32 srcR, srcG, srcB, srcA;
5464 Uint32 dstR, dstG, dstB;
5466 while (info->dst_h--) {
5467 Uint32 *src = (Uint32 *)info->src;
5468 Uint32 *dst = (Uint32 *)info->dst;
5469 int n = info->dst_w;
5472 srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
5474 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel;
5475 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
5476 /* This goes away if we ever use premultiplied alpha */
5478 srcR = (srcR * srcA) / 255;
5479 srcG = (srcG * srcA) / 255;
5480 srcB = (srcB * srcA) / 255;
5483 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
5484 case SDL_COPY_BLEND:
5485 dstR = srcR + ((255 - srcA) * dstR) / 255;
5486 dstG = srcG + ((255 - srcA) * dstG) / 255;
5487 dstB = srcB + ((255 - srcA) * dstB) / 255;
5490 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
5491 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
5492 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
5495 dstR = (srcR * dstR) / 255;
5496 dstG = (srcG * dstG) / 255;
5497 dstB = (srcB * dstB) / 255;
5500 dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
5501 dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
5502 dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
5505 dstpixel = (dstB << 16) | (dstG << 8) | dstR;
5510 info->src += info->src_pitch;
5511 info->dst += info->dst_pitch;
5515 static void SDL_Blit_ABGR8888_BGR888_Blend_Scale(SDL_BlitInfo *info)
5517 const int flags = info->flags;
5519 Uint32 srcR, srcG, srcB, srcA;
5521 Uint32 dstR, dstG, dstB;
5528 incy = (info->src_h << 16) / info->dst_h;
5529 incx = (info->src_w << 16) / info->dst_w;
5531 while (info->dst_h--) {
5533 Uint32 *dst = (Uint32 *)info->dst;
5534 int n = info->dst_w;
5537 while (posy >= 0x10000L) {
5542 if (posx >= 0x10000L) {
5543 while (posx >= 0x10000L) {
5547 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
5550 srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
5552 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel;
5553 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
5554 /* This goes away if we ever use premultiplied alpha */
5556 srcR = (srcR * srcA) / 255;
5557 srcG = (srcG * srcA) / 255;
5558 srcB = (srcB * srcA) / 255;
5561 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
5562 case SDL_COPY_BLEND:
5563 dstR = srcR + ((255 - srcA) * dstR) / 255;
5564 dstG = srcG + ((255 - srcA) * dstG) / 255;
5565 dstB = srcB + ((255 - srcA) * dstB) / 255;
5568 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
5569 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
5570 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
5573 dstR = (srcR * dstR) / 255;
5574 dstG = (srcG * dstG) / 255;
5575 dstB = (srcB * dstB) / 255;
5578 dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
5579 dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
5580 dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
5583 dstpixel = (dstB << 16) | (dstG << 8) | dstR;
5589 info->dst += info->dst_pitch;
5593 static void SDL_Blit_ABGR8888_BGR888_Modulate(SDL_BlitInfo *info)
5595 const int flags = info->flags;
5596 const Uint32 modulateR = info->r;
5597 const Uint32 modulateG = info->g;
5598 const Uint32 modulateB = info->b;
5602 while (info->dst_h--) {
5603 Uint32 *src = (Uint32 *)info->src;
5604 Uint32 *dst = (Uint32 *)info->dst;
5605 int n = info->dst_w;
5608 B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
5609 if (flags & SDL_COPY_MODULATE_COLOR) {
5610 R = (R * modulateR) / 255;
5611 G = (G * modulateG) / 255;
5612 B = (B * modulateB) / 255;
5614 pixel = (B << 16) | (G << 8) | R;
5619 info->src += info->src_pitch;
5620 info->dst += info->dst_pitch;
5624 static void SDL_Blit_ABGR8888_BGR888_Modulate_Scale(SDL_BlitInfo *info)
5626 const int flags = info->flags;
5627 const Uint32 modulateR = info->r;
5628 const Uint32 modulateG = info->g;
5629 const Uint32 modulateB = info->b;
5638 incy = (info->src_h << 16) / info->dst_h;
5639 incx = (info->src_w << 16) / info->dst_w;
5641 while (info->dst_h--) {
5643 Uint32 *dst = (Uint32 *)info->dst;
5644 int n = info->dst_w;
5647 while (posy >= 0x10000L) {
5652 if (posx >= 0x10000L) {
5653 while (posx >= 0x10000L) {
5657 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
5660 B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
5661 if (flags & SDL_COPY_MODULATE_COLOR) {
5662 R = (R * modulateR) / 255;
5663 G = (G * modulateG) / 255;
5664 B = (B * modulateB) / 255;
5666 pixel = (B << 16) | (G << 8) | R;
5672 info->dst += info->dst_pitch;
5676 static void SDL_Blit_ABGR8888_BGR888_Modulate_Blend(SDL_BlitInfo *info)
5678 const int flags = info->flags;
5679 const Uint32 modulateR = info->r;
5680 const Uint32 modulateG = info->g;
5681 const Uint32 modulateB = info->b;
5682 const Uint32 modulateA = info->a;
5684 Uint32 srcR, srcG, srcB, srcA;
5686 Uint32 dstR, dstG, dstB;
5688 while (info->dst_h--) {
5689 Uint32 *src = (Uint32 *)info->src;
5690 Uint32 *dst = (Uint32 *)info->dst;
5691 int n = info->dst_w;
5694 srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
5696 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel;
5697 if (flags & SDL_COPY_MODULATE_COLOR) {
5698 srcR = (srcR * modulateR) / 255;
5699 srcG = (srcG * modulateG) / 255;
5700 srcB = (srcB * modulateB) / 255;
5702 if (flags & SDL_COPY_MODULATE_ALPHA) {
5703 srcA = (srcA * modulateA) / 255;
5705 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
5706 /* This goes away if we ever use premultiplied alpha */
5708 srcR = (srcR * srcA) / 255;
5709 srcG = (srcG * srcA) / 255;
5710 srcB = (srcB * srcA) / 255;
5713 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
5714 case SDL_COPY_BLEND:
5715 dstR = srcR + ((255 - srcA) * dstR) / 255;
5716 dstG = srcG + ((255 - srcA) * dstG) / 255;
5717 dstB = srcB + ((255 - srcA) * dstB) / 255;
5720 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
5721 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
5722 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
5725 dstR = (srcR * dstR) / 255;
5726 dstG = (srcG * dstG) / 255;
5727 dstB = (srcB * dstB) / 255;
5730 dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
5731 dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
5732 dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
5735 dstpixel = (dstB << 16) | (dstG << 8) | dstR;
5740 info->src += info->src_pitch;
5741 info->dst += info->dst_pitch;
5745 static void SDL_Blit_ABGR8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info)
5747 const int flags = info->flags;
5748 const Uint32 modulateR = info->r;
5749 const Uint32 modulateG = info->g;
5750 const Uint32 modulateB = info->b;
5751 const Uint32 modulateA = info->a;
5753 Uint32 srcR, srcG, srcB, srcA;
5755 Uint32 dstR, dstG, dstB;
5762 incy = (info->src_h << 16) / info->dst_h;
5763 incx = (info->src_w << 16) / info->dst_w;
5765 while (info->dst_h--) {
5767 Uint32 *dst = (Uint32 *)info->dst;
5768 int n = info->dst_w;
5771 while (posy >= 0x10000L) {
5776 if (posx >= 0x10000L) {
5777 while (posx >= 0x10000L) {
5781 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
5784 srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
5786 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel;
5787 if (flags & SDL_COPY_MODULATE_COLOR) {
5788 srcR = (srcR * modulateR) / 255;
5789 srcG = (srcG * modulateG) / 255;
5790 srcB = (srcB * modulateB) / 255;
5792 if (flags & SDL_COPY_MODULATE_ALPHA) {
5793 srcA = (srcA * modulateA) / 255;
5795 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
5796 /* This goes away if we ever use premultiplied alpha */
5798 srcR = (srcR * srcA) / 255;
5799 srcG = (srcG * srcA) / 255;
5800 srcB = (srcB * srcA) / 255;
5803 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
5804 case SDL_COPY_BLEND:
5805 dstR = srcR + ((255 - srcA) * dstR) / 255;
5806 dstG = srcG + ((255 - srcA) * dstG) / 255;
5807 dstB = srcB + ((255 - srcA) * dstB) / 255;
5810 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
5811 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
5812 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
5815 dstR = (srcR * dstR) / 255;
5816 dstG = (srcG * dstG) / 255;
5817 dstB = (srcB * dstB) / 255;
5820 dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
5821 dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
5822 dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
5825 dstpixel = (dstB << 16) | (dstG << 8) | dstR;
5831 info->dst += info->dst_pitch;
5835 static void SDL_Blit_ABGR8888_ARGB8888_Scale(SDL_BlitInfo *info)
5845 incy = (info->src_h << 16) / info->dst_h;
5846 incx = (info->src_w << 16) / info->dst_w;
5848 while (info->dst_h--) {
5850 Uint32 *dst = (Uint32 *)info->dst;
5851 int n = info->dst_w;
5854 while (posy >= 0x10000L) {
5859 if (posx >= 0x10000L) {
5860 while (posx >= 0x10000L) {
5864 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
5867 B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; A = (Uint8)(pixel >> 24);
5868 pixel = (A << 24) | (R << 16) | (G << 8) | B;
5874 info->dst += info->dst_pitch;
5878 static void SDL_Blit_ABGR8888_ARGB8888_Blend(SDL_BlitInfo *info)
5880 const int flags = info->flags;
5882 Uint32 srcR, srcG, srcB, srcA;
5884 Uint32 dstR, dstG, dstB, dstA;
5886 while (info->dst_h--) {
5887 Uint32 *src = (Uint32 *)info->src;
5888 Uint32 *dst = (Uint32 *)info->dst;
5889 int n = info->dst_w;
5892 srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
5894 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
5895 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
5896 /* This goes away if we ever use premultiplied alpha */
5898 srcR = (srcR * srcA) / 255;
5899 srcG = (srcG * srcA) / 255;
5900 srcB = (srcB * srcA) / 255;
5903 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
5904 case SDL_COPY_BLEND:
5905 dstR = srcR + ((255 - srcA) * dstR) / 255;
5906 dstG = srcG + ((255 - srcA) * dstG) / 255;
5907 dstB = srcB + ((255 - srcA) * dstB) / 255;
5908 dstA = srcA + ((255 - srcA) * dstA) / 255;
5911 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
5912 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
5913 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
5916 dstR = (srcR * dstR) / 255;
5917 dstG = (srcG * dstG) / 255;
5918 dstB = (srcB * dstB) / 255;
5921 dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
5922 dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
5923 dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
5924 dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) dstA = 255;
5927 dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB;
5932 info->src += info->src_pitch;
5933 info->dst += info->dst_pitch;
5937 static void SDL_Blit_ABGR8888_ARGB8888_Blend_Scale(SDL_BlitInfo *info)
5939 const int flags = info->flags;
5941 Uint32 srcR, srcG, srcB, srcA;
5943 Uint32 dstR, dstG, dstB, dstA;
5950 incy = (info->src_h << 16) / info->dst_h;
5951 incx = (info->src_w << 16) / info->dst_w;
5953 while (info->dst_h--) {
5955 Uint32 *dst = (Uint32 *)info->dst;
5956 int n = info->dst_w;
5959 while (posy >= 0x10000L) {
5964 if (posx >= 0x10000L) {
5965 while (posx >= 0x10000L) {
5969 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
5972 srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
5974 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
5975 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
5976 /* This goes away if we ever use premultiplied alpha */
5978 srcR = (srcR * srcA) / 255;
5979 srcG = (srcG * srcA) / 255;
5980 srcB = (srcB * srcA) / 255;
5983 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
5984 case SDL_COPY_BLEND:
5985 dstR = srcR + ((255 - srcA) * dstR) / 255;
5986 dstG = srcG + ((255 - srcA) * dstG) / 255;
5987 dstB = srcB + ((255 - srcA) * dstB) / 255;
5988 dstA = srcA + ((255 - srcA) * dstA) / 255;
5991 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
5992 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
5993 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
5996 dstR = (srcR * dstR) / 255;
5997 dstG = (srcG * dstG) / 255;
5998 dstB = (srcB * dstB) / 255;
6001 dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
6002 dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
6003 dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
6004 dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) dstA = 255;
6007 dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB;
6013 info->dst += info->dst_pitch;
6017 static void SDL_Blit_ABGR8888_ARGB8888_Modulate(SDL_BlitInfo *info)
6019 const int flags = info->flags;
6020 const Uint32 modulateR = info->r;
6021 const Uint32 modulateG = info->g;
6022 const Uint32 modulateB = info->b;
6023 const Uint32 modulateA = info->a;
6027 while (info->dst_h--) {
6028 Uint32 *src = (Uint32 *)info->src;
6029 Uint32 *dst = (Uint32 *)info->dst;
6030 int n = info->dst_w;
6033 B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; A = (Uint8)(pixel >> 24);
6034 if (flags & SDL_COPY_MODULATE_COLOR) {
6035 R = (R * modulateR) / 255;
6036 G = (G * modulateG) / 255;
6037 B = (B * modulateB) / 255;
6039 if (flags & SDL_COPY_MODULATE_ALPHA) {
6040 A = (A * modulateA) / 255;
6042 pixel = (A << 24) | (R << 16) | (G << 8) | B;
6047 info->src += info->src_pitch;
6048 info->dst += info->dst_pitch;
6052 static void SDL_Blit_ABGR8888_ARGB8888_Modulate_Scale(SDL_BlitInfo *info)
6054 const int flags = info->flags;
6055 const Uint32 modulateR = info->r;
6056 const Uint32 modulateG = info->g;
6057 const Uint32 modulateB = info->b;
6058 const Uint32 modulateA = info->a;
6067 incy = (info->src_h << 16) / info->dst_h;
6068 incx = (info->src_w << 16) / info->dst_w;
6070 while (info->dst_h--) {
6072 Uint32 *dst = (Uint32 *)info->dst;
6073 int n = info->dst_w;
6076 while (posy >= 0x10000L) {
6081 if (posx >= 0x10000L) {
6082 while (posx >= 0x10000L) {
6086 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
6089 B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; A = (Uint8)(pixel >> 24);
6090 if (flags & SDL_COPY_MODULATE_COLOR) {
6091 R = (R * modulateR) / 255;
6092 G = (G * modulateG) / 255;
6093 B = (B * modulateB) / 255;
6095 if (flags & SDL_COPY_MODULATE_ALPHA) {
6096 A = (A * modulateA) / 255;
6098 pixel = (A << 24) | (R << 16) | (G << 8) | B;
6104 info->dst += info->dst_pitch;
6108 static void SDL_Blit_ABGR8888_ARGB8888_Modulate_Blend(SDL_BlitInfo *info)
6110 const int flags = info->flags;
6111 const Uint32 modulateR = info->r;
6112 const Uint32 modulateG = info->g;
6113 const Uint32 modulateB = info->b;
6114 const Uint32 modulateA = info->a;
6116 Uint32 srcR, srcG, srcB, srcA;
6118 Uint32 dstR, dstG, dstB, dstA;
6120 while (info->dst_h--) {
6121 Uint32 *src = (Uint32 *)info->src;
6122 Uint32 *dst = (Uint32 *)info->dst;
6123 int n = info->dst_w;
6126 srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
6128 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
6129 if (flags & SDL_COPY_MODULATE_COLOR) {
6130 srcR = (srcR * modulateR) / 255;
6131 srcG = (srcG * modulateG) / 255;
6132 srcB = (srcB * modulateB) / 255;
6134 if (flags & SDL_COPY_MODULATE_ALPHA) {
6135 srcA = (srcA * modulateA) / 255;
6137 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
6138 /* This goes away if we ever use premultiplied alpha */
6140 srcR = (srcR * srcA) / 255;
6141 srcG = (srcG * srcA) / 255;
6142 srcB = (srcB * srcA) / 255;
6145 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
6146 case SDL_COPY_BLEND:
6147 dstR = srcR + ((255 - srcA) * dstR) / 255;
6148 dstG = srcG + ((255 - srcA) * dstG) / 255;
6149 dstB = srcB + ((255 - srcA) * dstB) / 255;
6150 dstA = srcA + ((255 - srcA) * dstA) / 255;
6153 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
6154 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
6155 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
6158 dstR = (srcR * dstR) / 255;
6159 dstG = (srcG * dstG) / 255;
6160 dstB = (srcB * dstB) / 255;
6163 dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
6164 dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
6165 dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
6166 dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) dstA = 255;
6169 dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB;
6174 info->src += info->src_pitch;
6175 info->dst += info->dst_pitch;
6179 static void SDL_Blit_ABGR8888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info)
6181 const int flags = info->flags;
6182 const Uint32 modulateR = info->r;
6183 const Uint32 modulateG = info->g;
6184 const Uint32 modulateB = info->b;
6185 const Uint32 modulateA = info->a;
6187 Uint32 srcR, srcG, srcB, srcA;
6189 Uint32 dstR, dstG, dstB, dstA;
6196 incy = (info->src_h << 16) / info->dst_h;
6197 incx = (info->src_w << 16) / info->dst_w;
6199 while (info->dst_h--) {
6201 Uint32 *dst = (Uint32 *)info->dst;
6202 int n = info->dst_w;
6205 while (posy >= 0x10000L) {
6210 if (posx >= 0x10000L) {
6211 while (posx >= 0x10000L) {
6215 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
6218 srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
6220 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
6221 if (flags & SDL_COPY_MODULATE_COLOR) {
6222 srcR = (srcR * modulateR) / 255;
6223 srcG = (srcG * modulateG) / 255;
6224 srcB = (srcB * modulateB) / 255;
6226 if (flags & SDL_COPY_MODULATE_ALPHA) {
6227 srcA = (srcA * modulateA) / 255;
6229 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
6230 /* This goes away if we ever use premultiplied alpha */
6232 srcR = (srcR * srcA) / 255;
6233 srcG = (srcG * srcA) / 255;
6234 srcB = (srcB * srcA) / 255;
6237 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
6238 case SDL_COPY_BLEND:
6239 dstR = srcR + ((255 - srcA) * dstR) / 255;
6240 dstG = srcG + ((255 - srcA) * dstG) / 255;
6241 dstB = srcB + ((255 - srcA) * dstB) / 255;
6242 dstA = srcA + ((255 - srcA) * dstA) / 255;
6245 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
6246 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
6247 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
6250 dstR = (srcR * dstR) / 255;
6251 dstG = (srcG * dstG) / 255;
6252 dstB = (srcB * dstB) / 255;
6255 dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
6256 dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
6257 dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
6258 dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) dstA = 255;
6261 dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB;
6267 info->dst += info->dst_pitch;
6271 static void SDL_Blit_BGRA8888_RGB888_Scale(SDL_BlitInfo *info)
6281 incy = (info->src_h << 16) / info->dst_h;
6282 incx = (info->src_w << 16) / info->dst_w;
6284 while (info->dst_h--) {
6286 Uint32 *dst = (Uint32 *)info->dst;
6287 int n = info->dst_w;
6290 while (posy >= 0x10000L) {
6295 if (posx >= 0x10000L) {
6296 while (posx >= 0x10000L) {
6300 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
6303 B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8);
6304 pixel = (R << 16) | (G << 8) | B;
6310 info->dst += info->dst_pitch;
6314 static void SDL_Blit_BGRA8888_RGB888_Blend(SDL_BlitInfo *info)
6316 const int flags = info->flags;
6318 Uint32 srcR, srcG, srcB, srcA;
6320 Uint32 dstR, dstG, dstB;
6322 while (info->dst_h--) {
6323 Uint32 *src = (Uint32 *)info->src;
6324 Uint32 *dst = (Uint32 *)info->dst;
6325 int n = info->dst_w;
6328 srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
6330 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
6331 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
6332 /* This goes away if we ever use premultiplied alpha */
6334 srcR = (srcR * srcA) / 255;
6335 srcG = (srcG * srcA) / 255;
6336 srcB = (srcB * srcA) / 255;
6339 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
6340 case SDL_COPY_BLEND:
6341 dstR = srcR + ((255 - srcA) * dstR) / 255;
6342 dstG = srcG + ((255 - srcA) * dstG) / 255;
6343 dstB = srcB + ((255 - srcA) * dstB) / 255;
6346 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
6347 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
6348 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
6351 dstR = (srcR * dstR) / 255;
6352 dstG = (srcG * dstG) / 255;
6353 dstB = (srcB * dstB) / 255;
6356 dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
6357 dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
6358 dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
6361 dstpixel = (dstR << 16) | (dstG << 8) | dstB;
6366 info->src += info->src_pitch;
6367 info->dst += info->dst_pitch;
6371 static void SDL_Blit_BGRA8888_RGB888_Blend_Scale(SDL_BlitInfo *info)
6373 const int flags = info->flags;
6375 Uint32 srcR, srcG, srcB, srcA;
6377 Uint32 dstR, dstG, dstB;
6384 incy = (info->src_h << 16) / info->dst_h;
6385 incx = (info->src_w << 16) / info->dst_w;
6387 while (info->dst_h--) {
6389 Uint32 *dst = (Uint32 *)info->dst;
6390 int n = info->dst_w;
6393 while (posy >= 0x10000L) {
6398 if (posx >= 0x10000L) {
6399 while (posx >= 0x10000L) {
6403 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
6406 srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
6408 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
6409 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
6410 /* This goes away if we ever use premultiplied alpha */
6412 srcR = (srcR * srcA) / 255;
6413 srcG = (srcG * srcA) / 255;
6414 srcB = (srcB * srcA) / 255;
6417 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
6418 case SDL_COPY_BLEND:
6419 dstR = srcR + ((255 - srcA) * dstR) / 255;
6420 dstG = srcG + ((255 - srcA) * dstG) / 255;
6421 dstB = srcB + ((255 - srcA) * dstB) / 255;
6424 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
6425 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
6426 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
6429 dstR = (srcR * dstR) / 255;
6430 dstG = (srcG * dstG) / 255;
6431 dstB = (srcB * dstB) / 255;
6434 dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
6435 dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
6436 dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
6439 dstpixel = (dstR << 16) | (dstG << 8) | dstB;
6445 info->dst += info->dst_pitch;
6449 static void SDL_Blit_BGRA8888_RGB888_Modulate(SDL_BlitInfo *info)
6451 const int flags = info->flags;
6452 const Uint32 modulateR = info->r;
6453 const Uint32 modulateG = info->g;
6454 const Uint32 modulateB = info->b;
6458 while (info->dst_h--) {
6459 Uint32 *src = (Uint32 *)info->src;
6460 Uint32 *dst = (Uint32 *)info->dst;
6461 int n = info->dst_w;
6464 B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8);
6465 if (flags & SDL_COPY_MODULATE_COLOR) {
6466 R = (R * modulateR) / 255;
6467 G = (G * modulateG) / 255;
6468 B = (B * modulateB) / 255;
6470 pixel = (R << 16) | (G << 8) | B;
6475 info->src += info->src_pitch;
6476 info->dst += info->dst_pitch;
6480 static void SDL_Blit_BGRA8888_RGB888_Modulate_Scale(SDL_BlitInfo *info)
6482 const int flags = info->flags;
6483 const Uint32 modulateR = info->r;
6484 const Uint32 modulateG = info->g;
6485 const Uint32 modulateB = info->b;
6494 incy = (info->src_h << 16) / info->dst_h;
6495 incx = (info->src_w << 16) / info->dst_w;
6497 while (info->dst_h--) {
6499 Uint32 *dst = (Uint32 *)info->dst;
6500 int n = info->dst_w;
6503 while (posy >= 0x10000L) {
6508 if (posx >= 0x10000L) {
6509 while (posx >= 0x10000L) {
6513 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
6516 B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8);
6517 if (flags & SDL_COPY_MODULATE_COLOR) {
6518 R = (R * modulateR) / 255;
6519 G = (G * modulateG) / 255;
6520 B = (B * modulateB) / 255;
6522 pixel = (R << 16) | (G << 8) | B;
6528 info->dst += info->dst_pitch;
6532 static void SDL_Blit_BGRA8888_RGB888_Modulate_Blend(SDL_BlitInfo *info)
6534 const int flags = info->flags;
6535 const Uint32 modulateR = info->r;
6536 const Uint32 modulateG = info->g;
6537 const Uint32 modulateB = info->b;
6538 const Uint32 modulateA = info->a;
6540 Uint32 srcR, srcG, srcB, srcA;
6542 Uint32 dstR, dstG, dstB;
6544 while (info->dst_h--) {
6545 Uint32 *src = (Uint32 *)info->src;
6546 Uint32 *dst = (Uint32 *)info->dst;
6547 int n = info->dst_w;
6550 srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
6552 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
6553 if (flags & SDL_COPY_MODULATE_COLOR) {
6554 srcR = (srcR * modulateR) / 255;
6555 srcG = (srcG * modulateG) / 255;
6556 srcB = (srcB * modulateB) / 255;
6558 if (flags & SDL_COPY_MODULATE_ALPHA) {
6559 srcA = (srcA * modulateA) / 255;
6561 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
6562 /* This goes away if we ever use premultiplied alpha */
6564 srcR = (srcR * srcA) / 255;
6565 srcG = (srcG * srcA) / 255;
6566 srcB = (srcB * srcA) / 255;
6569 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
6570 case SDL_COPY_BLEND:
6571 dstR = srcR + ((255 - srcA) * dstR) / 255;
6572 dstG = srcG + ((255 - srcA) * dstG) / 255;
6573 dstB = srcB + ((255 - srcA) * dstB) / 255;
6576 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
6577 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
6578 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
6581 dstR = (srcR * dstR) / 255;
6582 dstG = (srcG * dstG) / 255;
6583 dstB = (srcB * dstB) / 255;
6586 dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
6587 dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
6588 dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
6591 dstpixel = (dstR << 16) | (dstG << 8) | dstB;
6596 info->src += info->src_pitch;
6597 info->dst += info->dst_pitch;
6601 static void SDL_Blit_BGRA8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info)
6603 const int flags = info->flags;
6604 const Uint32 modulateR = info->r;
6605 const Uint32 modulateG = info->g;
6606 const Uint32 modulateB = info->b;
6607 const Uint32 modulateA = info->a;
6609 Uint32 srcR, srcG, srcB, srcA;
6611 Uint32 dstR, dstG, dstB;
6618 incy = (info->src_h << 16) / info->dst_h;
6619 incx = (info->src_w << 16) / info->dst_w;
6621 while (info->dst_h--) {
6623 Uint32 *dst = (Uint32 *)info->dst;
6624 int n = info->dst_w;
6627 while (posy >= 0x10000L) {
6632 if (posx >= 0x10000L) {
6633 while (posx >= 0x10000L) {
6637 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
6640 srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
6642 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
6643 if (flags & SDL_COPY_MODULATE_COLOR) {
6644 srcR = (srcR * modulateR) / 255;
6645 srcG = (srcG * modulateG) / 255;
6646 srcB = (srcB * modulateB) / 255;
6648 if (flags & SDL_COPY_MODULATE_ALPHA) {
6649 srcA = (srcA * modulateA) / 255;
6651 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
6652 /* This goes away if we ever use premultiplied alpha */
6654 srcR = (srcR * srcA) / 255;
6655 srcG = (srcG * srcA) / 255;
6656 srcB = (srcB * srcA) / 255;
6659 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
6660 case SDL_COPY_BLEND:
6661 dstR = srcR + ((255 - srcA) * dstR) / 255;
6662 dstG = srcG + ((255 - srcA) * dstG) / 255;
6663 dstB = srcB + ((255 - srcA) * dstB) / 255;
6666 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
6667 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
6668 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
6671 dstR = (srcR * dstR) / 255;
6672 dstG = (srcG * dstG) / 255;
6673 dstB = (srcB * dstB) / 255;
6676 dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
6677 dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
6678 dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
6681 dstpixel = (dstR << 16) | (dstG << 8) | dstB;
6687 info->dst += info->dst_pitch;
6691 static void SDL_Blit_BGRA8888_BGR888_Scale(SDL_BlitInfo *info)
6701 incy = (info->src_h << 16) / info->dst_h;
6702 incx = (info->src_w << 16) / info->dst_w;
6704 while (info->dst_h--) {
6706 Uint32 *dst = (Uint32 *)info->dst;
6707 int n = info->dst_w;
6710 while (posy >= 0x10000L) {
6715 if (posx >= 0x10000L) {
6716 while (posx >= 0x10000L) {
6720 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
6723 B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8);
6724 pixel = (B << 16) | (G << 8) | R;
6730 info->dst += info->dst_pitch;
6734 static void SDL_Blit_BGRA8888_BGR888_Blend(SDL_BlitInfo *info)
6736 const int flags = info->flags;
6738 Uint32 srcR, srcG, srcB, srcA;
6740 Uint32 dstR, dstG, dstB;
6742 while (info->dst_h--) {
6743 Uint32 *src = (Uint32 *)info->src;
6744 Uint32 *dst = (Uint32 *)info->dst;
6745 int n = info->dst_w;
6748 srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
6750 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel;
6751 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
6752 /* This goes away if we ever use premultiplied alpha */
6754 srcR = (srcR * srcA) / 255;
6755 srcG = (srcG * srcA) / 255;
6756 srcB = (srcB * srcA) / 255;
6759 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
6760 case SDL_COPY_BLEND:
6761 dstR = srcR + ((255 - srcA) * dstR) / 255;
6762 dstG = srcG + ((255 - srcA) * dstG) / 255;
6763 dstB = srcB + ((255 - srcA) * dstB) / 255;
6766 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
6767 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
6768 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
6771 dstR = (srcR * dstR) / 255;
6772 dstG = (srcG * dstG) / 255;
6773 dstB = (srcB * dstB) / 255;
6776 dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
6777 dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
6778 dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
6781 dstpixel = (dstB << 16) | (dstG << 8) | dstR;
6786 info->src += info->src_pitch;
6787 info->dst += info->dst_pitch;
6791 static void SDL_Blit_BGRA8888_BGR888_Blend_Scale(SDL_BlitInfo *info)
6793 const int flags = info->flags;
6795 Uint32 srcR, srcG, srcB, srcA;
6797 Uint32 dstR, dstG, dstB;
6804 incy = (info->src_h << 16) / info->dst_h;
6805 incx = (info->src_w << 16) / info->dst_w;
6807 while (info->dst_h--) {
6809 Uint32 *dst = (Uint32 *)info->dst;
6810 int n = info->dst_w;
6813 while (posy >= 0x10000L) {
6818 if (posx >= 0x10000L) {
6819 while (posx >= 0x10000L) {
6823 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
6826 srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
6828 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel;
6829 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
6830 /* This goes away if we ever use premultiplied alpha */
6832 srcR = (srcR * srcA) / 255;
6833 srcG = (srcG * srcA) / 255;
6834 srcB = (srcB * srcA) / 255;
6837 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
6838 case SDL_COPY_BLEND:
6839 dstR = srcR + ((255 - srcA) * dstR) / 255;
6840 dstG = srcG + ((255 - srcA) * dstG) / 255;
6841 dstB = srcB + ((255 - srcA) * dstB) / 255;
6844 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
6845 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
6846 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
6849 dstR = (srcR * dstR) / 255;
6850 dstG = (srcG * dstG) / 255;
6851 dstB = (srcB * dstB) / 255;
6854 dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
6855 dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
6856 dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
6859 dstpixel = (dstB << 16) | (dstG << 8) | dstR;
6865 info->dst += info->dst_pitch;
6869 static void SDL_Blit_BGRA8888_BGR888_Modulate(SDL_BlitInfo *info)
6871 const int flags = info->flags;
6872 const Uint32 modulateR = info->r;
6873 const Uint32 modulateG = info->g;
6874 const Uint32 modulateB = info->b;
6878 while (info->dst_h--) {
6879 Uint32 *src = (Uint32 *)info->src;
6880 Uint32 *dst = (Uint32 *)info->dst;
6881 int n = info->dst_w;
6884 B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8);
6885 if (flags & SDL_COPY_MODULATE_COLOR) {
6886 R = (R * modulateR) / 255;
6887 G = (G * modulateG) / 255;
6888 B = (B * modulateB) / 255;
6890 pixel = (B << 16) | (G << 8) | R;
6895 info->src += info->src_pitch;
6896 info->dst += info->dst_pitch;
6900 static void SDL_Blit_BGRA8888_BGR888_Modulate_Scale(SDL_BlitInfo *info)
6902 const int flags = info->flags;
6903 const Uint32 modulateR = info->r;
6904 const Uint32 modulateG = info->g;
6905 const Uint32 modulateB = info->b;
6914 incy = (info->src_h << 16) / info->dst_h;
6915 incx = (info->src_w << 16) / info->dst_w;
6917 while (info->dst_h--) {
6919 Uint32 *dst = (Uint32 *)info->dst;
6920 int n = info->dst_w;
6923 while (posy >= 0x10000L) {
6928 if (posx >= 0x10000L) {
6929 while (posx >= 0x10000L) {
6933 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
6936 B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8);
6937 if (flags & SDL_COPY_MODULATE_COLOR) {
6938 R = (R * modulateR) / 255;
6939 G = (G * modulateG) / 255;
6940 B = (B * modulateB) / 255;
6942 pixel = (B << 16) | (G << 8) | R;
6948 info->dst += info->dst_pitch;
6952 static void SDL_Blit_BGRA8888_BGR888_Modulate_Blend(SDL_BlitInfo *info)
6954 const int flags = info->flags;
6955 const Uint32 modulateR = info->r;
6956 const Uint32 modulateG = info->g;
6957 const Uint32 modulateB = info->b;
6958 const Uint32 modulateA = info->a;
6960 Uint32 srcR, srcG, srcB, srcA;
6962 Uint32 dstR, dstG, dstB;
6964 while (info->dst_h--) {
6965 Uint32 *src = (Uint32 *)info->src;
6966 Uint32 *dst = (Uint32 *)info->dst;
6967 int n = info->dst_w;
6970 srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
6972 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel;
6973 if (flags & SDL_COPY_MODULATE_COLOR) {
6974 srcR = (srcR * modulateR) / 255;
6975 srcG = (srcG * modulateG) / 255;
6976 srcB = (srcB * modulateB) / 255;
6978 if (flags & SDL_COPY_MODULATE_ALPHA) {
6979 srcA = (srcA * modulateA) / 255;
6981 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
6982 /* This goes away if we ever use premultiplied alpha */
6984 srcR = (srcR * srcA) / 255;
6985 srcG = (srcG * srcA) / 255;
6986 srcB = (srcB * srcA) / 255;
6989 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
6990 case SDL_COPY_BLEND:
6991 dstR = srcR + ((255 - srcA) * dstR) / 255;
6992 dstG = srcG + ((255 - srcA) * dstG) / 255;
6993 dstB = srcB + ((255 - srcA) * dstB) / 255;
6996 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
6997 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
6998 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
7001 dstR = (srcR * dstR) / 255;
7002 dstG = (srcG * dstG) / 255;
7003 dstB = (srcB * dstB) / 255;
7006 dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
7007 dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
7008 dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
7011 dstpixel = (dstB << 16) | (dstG << 8) | dstR;
7016 info->src += info->src_pitch;
7017 info->dst += info->dst_pitch;
7021 static void SDL_Blit_BGRA8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info)
7023 const int flags = info->flags;
7024 const Uint32 modulateR = info->r;
7025 const Uint32 modulateG = info->g;
7026 const Uint32 modulateB = info->b;
7027 const Uint32 modulateA = info->a;
7029 Uint32 srcR, srcG, srcB, srcA;
7031 Uint32 dstR, dstG, dstB;
7038 incy = (info->src_h << 16) / info->dst_h;
7039 incx = (info->src_w << 16) / info->dst_w;
7041 while (info->dst_h--) {
7043 Uint32 *dst = (Uint32 *)info->dst;
7044 int n = info->dst_w;
7047 while (posy >= 0x10000L) {
7052 if (posx >= 0x10000L) {
7053 while (posx >= 0x10000L) {
7057 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
7060 srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
7062 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel;
7063 if (flags & SDL_COPY_MODULATE_COLOR) {
7064 srcR = (srcR * modulateR) / 255;
7065 srcG = (srcG * modulateG) / 255;
7066 srcB = (srcB * modulateB) / 255;
7068 if (flags & SDL_COPY_MODULATE_ALPHA) {
7069 srcA = (srcA * modulateA) / 255;
7071 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
7072 /* This goes away if we ever use premultiplied alpha */
7074 srcR = (srcR * srcA) / 255;
7075 srcG = (srcG * srcA) / 255;
7076 srcB = (srcB * srcA) / 255;
7079 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
7080 case SDL_COPY_BLEND:
7081 dstR = srcR + ((255 - srcA) * dstR) / 255;
7082 dstG = srcG + ((255 - srcA) * dstG) / 255;
7083 dstB = srcB + ((255 - srcA) * dstB) / 255;
7086 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
7087 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
7088 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
7091 dstR = (srcR * dstR) / 255;
7092 dstG = (srcG * dstG) / 255;
7093 dstB = (srcB * dstB) / 255;
7096 dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
7097 dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
7098 dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
7101 dstpixel = (dstB << 16) | (dstG << 8) | dstR;
7107 info->dst += info->dst_pitch;
7111 static void SDL_Blit_BGRA8888_ARGB8888_Scale(SDL_BlitInfo *info)
7121 incy = (info->src_h << 16) / info->dst_h;
7122 incx = (info->src_w << 16) / info->dst_w;
7124 while (info->dst_h--) {
7126 Uint32 *dst = (Uint32 *)info->dst;
7127 int n = info->dst_w;
7130 while (posy >= 0x10000L) {
7135 if (posx >= 0x10000L) {
7136 while (posx >= 0x10000L) {
7140 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
7143 B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); A = (Uint8)pixel;
7144 pixel = (A << 24) | (R << 16) | (G << 8) | B;
7150 info->dst += info->dst_pitch;
7154 static void SDL_Blit_BGRA8888_ARGB8888_Blend(SDL_BlitInfo *info)
7156 const int flags = info->flags;
7158 Uint32 srcR, srcG, srcB, srcA;
7160 Uint32 dstR, dstG, dstB, dstA;
7162 while (info->dst_h--) {
7163 Uint32 *src = (Uint32 *)info->src;
7164 Uint32 *dst = (Uint32 *)info->dst;
7165 int n = info->dst_w;
7168 srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
7170 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
7171 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
7172 /* This goes away if we ever use premultiplied alpha */
7174 srcR = (srcR * srcA) / 255;
7175 srcG = (srcG * srcA) / 255;
7176 srcB = (srcB * srcA) / 255;
7179 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
7180 case SDL_COPY_BLEND:
7181 dstR = srcR + ((255 - srcA) * dstR) / 255;
7182 dstG = srcG + ((255 - srcA) * dstG) / 255;
7183 dstB = srcB + ((255 - srcA) * dstB) / 255;
7184 dstA = srcA + ((255 - srcA) * dstA) / 255;
7187 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
7188 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
7189 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
7192 dstR = (srcR * dstR) / 255;
7193 dstG = (srcG * dstG) / 255;
7194 dstB = (srcB * dstB) / 255;
7197 dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
7198 dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
7199 dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
7200 dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) dstA = 255;
7203 dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB;
7208 info->src += info->src_pitch;
7209 info->dst += info->dst_pitch;
7213 static void SDL_Blit_BGRA8888_ARGB8888_Blend_Scale(SDL_BlitInfo *info)
7215 const int flags = info->flags;
7217 Uint32 srcR, srcG, srcB, srcA;
7219 Uint32 dstR, dstG, dstB, dstA;
7226 incy = (info->src_h << 16) / info->dst_h;
7227 incx = (info->src_w << 16) / info->dst_w;
7229 while (info->dst_h--) {
7231 Uint32 *dst = (Uint32 *)info->dst;
7232 int n = info->dst_w;
7235 while (posy >= 0x10000L) {
7240 if (posx >= 0x10000L) {
7241 while (posx >= 0x10000L) {
7245 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
7248 srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
7250 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
7251 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
7252 /* This goes away if we ever use premultiplied alpha */
7254 srcR = (srcR * srcA) / 255;
7255 srcG = (srcG * srcA) / 255;
7256 srcB = (srcB * srcA) / 255;
7259 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
7260 case SDL_COPY_BLEND:
7261 dstR = srcR + ((255 - srcA) * dstR) / 255;
7262 dstG = srcG + ((255 - srcA) * dstG) / 255;
7263 dstB = srcB + ((255 - srcA) * dstB) / 255;
7264 dstA = srcA + ((255 - srcA) * dstA) / 255;
7267 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
7268 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
7269 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
7272 dstR = (srcR * dstR) / 255;
7273 dstG = (srcG * dstG) / 255;
7274 dstB = (srcB * dstB) / 255;
7277 dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
7278 dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
7279 dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
7280 dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) dstA = 255;
7283 dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB;
7289 info->dst += info->dst_pitch;
7293 static void SDL_Blit_BGRA8888_ARGB8888_Modulate(SDL_BlitInfo *info)
7295 const int flags = info->flags;
7296 const Uint32 modulateR = info->r;
7297 const Uint32 modulateG = info->g;
7298 const Uint32 modulateB = info->b;
7299 const Uint32 modulateA = info->a;
7303 while (info->dst_h--) {
7304 Uint32 *src = (Uint32 *)info->src;
7305 Uint32 *dst = (Uint32 *)info->dst;
7306 int n = info->dst_w;
7309 B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); A = (Uint8)pixel;
7310 if (flags & SDL_COPY_MODULATE_COLOR) {
7311 R = (R * modulateR) / 255;
7312 G = (G * modulateG) / 255;
7313 B = (B * modulateB) / 255;
7315 if (flags & SDL_COPY_MODULATE_ALPHA) {
7316 A = (A * modulateA) / 255;
7318 pixel = (A << 24) | (R << 16) | (G << 8) | B;
7323 info->src += info->src_pitch;
7324 info->dst += info->dst_pitch;
7328 static void SDL_Blit_BGRA8888_ARGB8888_Modulate_Scale(SDL_BlitInfo *info)
7330 const int flags = info->flags;
7331 const Uint32 modulateR = info->r;
7332 const Uint32 modulateG = info->g;
7333 const Uint32 modulateB = info->b;
7334 const Uint32 modulateA = info->a;
7343 incy = (info->src_h << 16) / info->dst_h;
7344 incx = (info->src_w << 16) / info->dst_w;
7346 while (info->dst_h--) {
7348 Uint32 *dst = (Uint32 *)info->dst;
7349 int n = info->dst_w;
7352 while (posy >= 0x10000L) {
7357 if (posx >= 0x10000L) {
7358 while (posx >= 0x10000L) {
7362 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
7365 B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); A = (Uint8)pixel;
7366 if (flags & SDL_COPY_MODULATE_COLOR) {
7367 R = (R * modulateR) / 255;
7368 G = (G * modulateG) / 255;
7369 B = (B * modulateB) / 255;
7371 if (flags & SDL_COPY_MODULATE_ALPHA) {
7372 A = (A * modulateA) / 255;
7374 pixel = (A << 24) | (R << 16) | (G << 8) | B;
7380 info->dst += info->dst_pitch;
7384 static void SDL_Blit_BGRA8888_ARGB8888_Modulate_Blend(SDL_BlitInfo *info)
7386 const int flags = info->flags;
7387 const Uint32 modulateR = info->r;
7388 const Uint32 modulateG = info->g;
7389 const Uint32 modulateB = info->b;
7390 const Uint32 modulateA = info->a;
7392 Uint32 srcR, srcG, srcB, srcA;
7394 Uint32 dstR, dstG, dstB, dstA;
7396 while (info->dst_h--) {
7397 Uint32 *src = (Uint32 *)info->src;
7398 Uint32 *dst = (Uint32 *)info->dst;
7399 int n = info->dst_w;
7402 srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
7404 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
7405 if (flags & SDL_COPY_MODULATE_COLOR) {
7406 srcR = (srcR * modulateR) / 255;
7407 srcG = (srcG * modulateG) / 255;
7408 srcB = (srcB * modulateB) / 255;
7410 if (flags & SDL_COPY_MODULATE_ALPHA) {
7411 srcA = (srcA * modulateA) / 255;
7413 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
7414 /* This goes away if we ever use premultiplied alpha */
7416 srcR = (srcR * srcA) / 255;
7417 srcG = (srcG * srcA) / 255;
7418 srcB = (srcB * srcA) / 255;
7421 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
7422 case SDL_COPY_BLEND:
7423 dstR = srcR + ((255 - srcA) * dstR) / 255;
7424 dstG = srcG + ((255 - srcA) * dstG) / 255;
7425 dstB = srcB + ((255 - srcA) * dstB) / 255;
7426 dstA = srcA + ((255 - srcA) * dstA) / 255;
7429 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
7430 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
7431 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
7434 dstR = (srcR * dstR) / 255;
7435 dstG = (srcG * dstG) / 255;
7436 dstB = (srcB * dstB) / 255;
7439 dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
7440 dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
7441 dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
7442 dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) dstA = 255;
7445 dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB;
7450 info->src += info->src_pitch;
7451 info->dst += info->dst_pitch;
7455 static void SDL_Blit_BGRA8888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info)
7457 const int flags = info->flags;
7458 const Uint32 modulateR = info->r;
7459 const Uint32 modulateG = info->g;
7460 const Uint32 modulateB = info->b;
7461 const Uint32 modulateA = info->a;
7463 Uint32 srcR, srcG, srcB, srcA;
7465 Uint32 dstR, dstG, dstB, dstA;
7472 incy = (info->src_h << 16) / info->dst_h;
7473 incx = (info->src_w << 16) / info->dst_w;
7475 while (info->dst_h--) {
7477 Uint32 *dst = (Uint32 *)info->dst;
7478 int n = info->dst_w;
7481 while (posy >= 0x10000L) {
7486 if (posx >= 0x10000L) {
7487 while (posx >= 0x10000L) {
7491 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
7494 srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
7496 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
7497 if (flags & SDL_COPY_MODULATE_COLOR) {
7498 srcR = (srcR * modulateR) / 255;
7499 srcG = (srcG * modulateG) / 255;
7500 srcB = (srcB * modulateB) / 255;
7502 if (flags & SDL_COPY_MODULATE_ALPHA) {
7503 srcA = (srcA * modulateA) / 255;
7505 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
7506 /* This goes away if we ever use premultiplied alpha */
7508 srcR = (srcR * srcA) / 255;
7509 srcG = (srcG * srcA) / 255;
7510 srcB = (srcB * srcA) / 255;
7513 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) {
7514 case SDL_COPY_BLEND:
7515 dstR = srcR + ((255 - srcA) * dstR) / 255;
7516 dstG = srcG + ((255 - srcA) * dstG) / 255;
7517 dstB = srcB + ((255 - srcA) * dstB) / 255;
7518 dstA = srcA + ((255 - srcA) * dstA) / 255;
7521 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
7522 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
7523 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
7526 dstR = (srcR * dstR) / 255;
7527 dstG = (srcG * dstG) / 255;
7528 dstB = (srcB * dstB) / 255;
7531 dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
7532 dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
7533 dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
7534 dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) dstA = 255;
7537 dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB;
7543 info->dst += info->dst_pitch;
7547 SDL_BlitFuncEntry SDL_GeneratedBlitFuncTable[] = {
7548 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_RGB888_Scale },
7549 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_RGB888_RGB888_Blend },
7550 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_RGB888_Blend_Scale },
7551 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_RGB888_RGB888_Modulate },
7552 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_RGB888_Modulate_Scale },
7553 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_RGB888_RGB888_Modulate_Blend },
7554 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_RGB888_Modulate_Blend_Scale },
7555 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_BGR888_Scale },
7556 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_RGB888_BGR888_Blend },
7557 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_BGR888_Blend_Scale },
7558 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_RGB888_BGR888_Modulate },
7559 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_BGR888_Modulate_Scale },
7560 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_RGB888_BGR888_Modulate_Blend },
7561 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_BGR888_Modulate_Blend_Scale },
7562 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_ARGB8888_Scale },
7563 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_RGB888_ARGB8888_Blend },
7564 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_ARGB8888_Blend_Scale },
7565 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_RGB888_ARGB8888_Modulate },
7566 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_ARGB8888_Modulate_Scale },
7567 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_RGB888_ARGB8888_Modulate_Blend },
7568 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_ARGB8888_Modulate_Blend_Scale },
7569 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Scale },
7570 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Blend },
7571 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Blend_Scale },
7572 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Modulate },
7573 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Modulate_Scale },
7574 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Modulate_Blend },
7575 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Modulate_Blend_Scale },
7576 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_BGR888_Scale },
7577 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_BGR888_BGR888_Blend },
7578 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_BGR888_Blend_Scale },
7579 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_BGR888_BGR888_Modulate },
7580 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_BGR888_Modulate_Scale },
7581 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_BGR888_BGR888_Modulate_Blend },
7582 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_BGR888_Modulate_Blend_Scale },
7583 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_ARGB8888_Scale },
7584 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_BGR888_ARGB8888_Blend },
7585 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_ARGB8888_Blend_Scale },
7586 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_BGR888_ARGB8888_Modulate },
7587 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_ARGB8888_Modulate_Scale },
7588 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_BGR888_ARGB8888_Modulate_Blend },
7589 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_ARGB8888_Modulate_Blend_Scale },
7590 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Scale },
7591 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Blend },
7592 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Blend_Scale },
7593 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Modulate },
7594 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Modulate_Scale },
7595 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Modulate_Blend },
7596 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Modulate_Blend_Scale },
7597 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_BGR888_Scale },
7598 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_ARGB8888_BGR888_Blend },
7599 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_BGR888_Blend_Scale },
7600 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_ARGB8888_BGR888_Modulate },
7601 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_BGR888_Modulate_Scale },
7602 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_ARGB8888_BGR888_Modulate_Blend },
7603 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_BGR888_Modulate_Blend_Scale },
7604 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_ARGB8888_Scale },
7605 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_ARGB8888_ARGB8888_Blend },
7606 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_ARGB8888_Blend_Scale },
7607 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_ARGB8888_ARGB8888_Modulate },
7608 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_ARGB8888_Modulate_Scale },
7609 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_ARGB8888_ARGB8888_Modulate_Blend },
7610 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_ARGB8888_Modulate_Blend_Scale },
7611 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Scale },
7612 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Blend },
7613 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Blend_Scale },
7614 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Modulate },
7615 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Modulate_Scale },
7616 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Modulate_Blend },
7617 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Modulate_Blend_Scale },
7618 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_BGR888_Scale },
7619 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_RGBA8888_BGR888_Blend },
7620 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_BGR888_Blend_Scale },
7621 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_RGBA8888_BGR888_Modulate },
7622 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_BGR888_Modulate_Scale },
7623 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_RGBA8888_BGR888_Modulate_Blend },
7624 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_BGR888_Modulate_Blend_Scale },
7625 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_ARGB8888_Scale },
7626 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_RGBA8888_ARGB8888_Blend },
7627 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_ARGB8888_Blend_Scale },
7628 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_RGBA8888_ARGB8888_Modulate },
7629 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_ARGB8888_Modulate_Scale },
7630 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_RGBA8888_ARGB8888_Modulate_Blend },
7631 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_ARGB8888_Modulate_Blend_Scale },
7632 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Scale },
7633 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Blend },
7634 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Blend_Scale },
7635 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Modulate },
7636 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Modulate_Scale },
7637 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Modulate_Blend },
7638 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Modulate_Blend_Scale },
7639 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_BGR888_Scale },
7640 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_ABGR8888_BGR888_Blend },
7641 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_BGR888_Blend_Scale },
7642 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_ABGR8888_BGR888_Modulate },
7643 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_BGR888_Modulate_Scale },
7644 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_ABGR8888_BGR888_Modulate_Blend },
7645 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_BGR888_Modulate_Blend_Scale },
7646 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_ARGB8888_Scale },
7647 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_ABGR8888_ARGB8888_Blend },
7648 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_ARGB8888_Blend_Scale },
7649 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_ABGR8888_ARGB8888_Modulate },
7650 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_ARGB8888_Modulate_Scale },
7651 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_ABGR8888_ARGB8888_Modulate_Blend },
7652 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_ARGB8888_Modulate_Blend_Scale },
7653 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Scale },
7654 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Blend },
7655 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Blend_Scale },
7656 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Modulate },
7657 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Modulate_Scale },
7658 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Modulate_Blend },
7659 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Modulate_Blend_Scale },
7660 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_BGR888_Scale },
7661 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_BGRA8888_BGR888_Blend },
7662 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_BGR888_Blend_Scale },
7663 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_BGRA8888_BGR888_Modulate },
7664 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_BGR888_Modulate_Scale },
7665 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_BGRA8888_BGR888_Modulate_Blend },
7666 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_BGR888_Modulate_Blend_Scale },
7667 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_ARGB8888_Scale },
7668 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_BGRA8888_ARGB8888_Blend },
7669 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_ARGB8888_Blend_Scale },
7670 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_BGRA8888_ARGB8888_Modulate },
7671 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_ARGB8888_Modulate_Scale },
7672 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_BGRA8888_ARGB8888_Modulate_Blend },
7673 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_ARGB8888_Modulate_Blend_Scale },
7674 { 0, 0, 0, 0, NULL }
7679 #endif /* SDL_HAVE_BLIT_AUTO */
7681 /* vi: set ts=4 sw=4 expandtab: */