Mercurial > sdl-ios-xcode
annotate src/video/SDL_blit_auto.c @ 3474:1edb86163d62
Of COURSE that trick wouldn't work on all renderers. Fall back to something for now, hopefully figure out a better way to do this later.
If we have to, we can use vertical line and horizontal line textures for vertical and horizontal lines, and then create custom textures for diagonal lines and software render those. It's terrible, but at least it would be pixel perfect.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sat, 21 Nov 2009 07:22:59 +0000 |
parents | 99210400e8b9 |
children | f7b03b6838cb |
rev | line source |
---|---|
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1 /* DO NOT EDIT! This file is generated by sdlgenblit.pl */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2 /* |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3 SDL - Simple DirectMedia Layer |
2859 | 4 Copyright (C) 1997-2009 Sam Lantinga |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6 This library is free software; you can redistribute it and/or |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7 modify it under the terms of the GNU Lesser General Public |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
8 License as published by the Free Software Foundation; either |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
9 version 2.1 of the License, or (at your option) any later version. |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
10 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
11 This library is distributed in the hope that it will be useful, |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
12 but WITHOUT ANY WARRANTY; without even the implied warranty of |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
14 Lesser General Public License for more details. |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
15 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
16 You should have received a copy of the GNU Lesser General Public |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
17 License along with this library; if not, write to the Free Software |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
18 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
19 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
20 Sam Lantinga |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
21 slouken@libsdl.org |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
22 */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
23 #include "SDL_config.h" |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
24 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
25 /* *INDENT-OFF* */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
26 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
27 #include "SDL_video.h" |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
28 #include "SDL_blit.h" |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
29 #include "SDL_blit_auto.h" |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
30 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
31 static void SDL_Blit_RGB888_RGB888_Scale(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
32 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
33 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
34 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
35 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
36 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
37 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
38 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
39 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
40 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
41 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
42 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
43 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
44 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
45 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
46 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
47 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
48 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
49 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
50 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
51 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
52 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
53 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
54 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
55 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
56 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
57 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
58 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
59 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
60 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
61 *dst = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
62 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
63 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
64 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
65 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
66 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
67 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
68 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
69 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
70 static void SDL_Blit_RGB888_RGB888_Blend(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
71 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
72 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
73 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
74 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
75 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
76 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
77 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
78 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
79 Uint32 *src = (Uint32 *)info->src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
80 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
81 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
82 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
83 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
84 srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
85 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
86 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
87 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
88 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
89 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
90 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
91 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
92 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
93 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
94 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
95 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
96 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
97 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
98 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
99 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
100 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
101 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
102 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
103 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
104 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
105 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
106 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
107 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
108 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
109 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
110 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
111 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
112 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
113 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
114 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
115 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
116 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
117 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
118 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
119 dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
120 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
121 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
122 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
123 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
124 info->src += info->src_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
125 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
126 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
127 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
128 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
129 static void SDL_Blit_RGB888_RGB888_Blend_Scale(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
130 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
131 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
132 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
133 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
134 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
135 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
136 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
137 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
138 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
139 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
140 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
141 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
142 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
143 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
144 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
145 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
146 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
147 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
148 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
149 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
150 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
151 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
152 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
153 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
154 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
155 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
156 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
157 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
158 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
159 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
160 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
161 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
162 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
163 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
164 srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
165 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
166 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
167 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
168 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
169 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
170 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
171 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
172 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
173 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
174 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
175 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
176 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
177 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
178 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
179 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
180 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
181 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
182 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
183 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
184 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
185 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
186 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
187 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
188 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
189 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
190 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
191 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
192 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
193 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
194 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
195 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
196 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
197 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
198 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
199 dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
200 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
201 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
202 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
203 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
204 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
205 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
206 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
207 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
208 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
209 static void SDL_Blit_RGB888_RGB888_Modulate(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
210 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
211 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
212 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
213 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
214 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
215 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
216 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
217 Uint32 R, G, B, A; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
218 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
219 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
220 Uint32 *src = (Uint32 *)info->src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
221 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
222 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
223 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
224 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
225 R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; A = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
226 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
227 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
228 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
229 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
230 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
231 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
232 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
233 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
234 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
235 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
236 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
237 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
238 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
239 info->src += info->src_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
240 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
241 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
242 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
243 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
244 static void SDL_Blit_RGB888_RGB888_Modulate_Scale(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
245 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
246 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
247 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
248 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
249 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
250 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
251 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
252 Uint32 R, G, B, A; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
253 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
254 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
255 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
256 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
257 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
258 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
259 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
260 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
261 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
262 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
263 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
264 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
265 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
266 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
267 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
268 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
269 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
270 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
271 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
272 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
273 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
274 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
275 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
276 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
277 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
278 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
279 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
280 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
281 R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; A = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
282 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
283 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
284 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
285 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
286 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
287 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
288 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
289 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
290 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
291 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
292 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
293 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
294 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
295 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
296 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
297 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
298 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
299 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
300 static void SDL_Blit_RGB888_RGB888_Modulate_Blend(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
301 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
302 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
303 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
304 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
305 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
306 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
307 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
308 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
309 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
310 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
311 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
312 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
313 Uint32 *src = (Uint32 *)info->src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
314 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
315 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
316 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
317 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
318 srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
319 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
320 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
321 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
322 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
323 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
324 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
325 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
326 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
327 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
328 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
329 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
330 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
331 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
332 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
333 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
334 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
335 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
336 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
337 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
338 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
339 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
340 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
341 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
342 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
343 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
344 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
345 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
346 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
347 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
348 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
349 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
350 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
351 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
352 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
353 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
354 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
355 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
356 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
357 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
358 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
359 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
360 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
361 dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
362 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
363 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
364 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
365 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
366 info->src += info->src_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
367 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
368 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
369 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
370 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
371 static void SDL_Blit_RGB888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
372 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
373 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
374 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
375 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
376 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
377 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
378 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
379 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
380 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
381 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
382 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
383 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
384 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
385 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
386 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
387 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
388 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
389 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
390 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
391 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
392 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
393 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
394 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
395 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
396 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
397 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
398 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
399 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
400 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
401 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
402 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
403 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
404 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
405 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
406 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
407 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
408 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
409 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
410 srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
411 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
412 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
413 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
414 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
415 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
416 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
417 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
418 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
419 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
420 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
421 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
422 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
423 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
424 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
425 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
426 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
427 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
428 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
429 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
430 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
431 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
432 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
433 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
434 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
435 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
436 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
437 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
438 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
439 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
440 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
441 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
442 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
443 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
444 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
445 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
446 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
447 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
448 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
449 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
450 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
451 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
452 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
453 dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
454 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
455 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
456 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
457 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
458 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
459 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
460 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
461 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
462 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
463 static void SDL_Blit_RGB888_BGR888_Scale(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
464 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
465 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
466 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
467 Uint32 R, G, B, A; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
468 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
469 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
470 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
471 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
472 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
473 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
474 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
475 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
476 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
477 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
478 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
479 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
480 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
481 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
482 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
483 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
484 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
485 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
486 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
487 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
488 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
489 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
490 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
491 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
492 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
493 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
494 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
495 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
496 R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; A = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
497 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
498 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
499 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
500 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
501 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
502 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
503 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
504 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
505 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
506 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
507 static void SDL_Blit_RGB888_BGR888_Blend(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
508 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
509 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
510 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
511 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
512 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
513 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
514 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
515 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
516 Uint32 *src = (Uint32 *)info->src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
517 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
518 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
519 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
520 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
521 srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
522 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
523 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
524 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
525 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
526 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
527 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
528 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
529 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
530 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
531 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
532 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
533 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
534 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
535 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
536 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
537 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
538 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
539 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
540 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
541 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
542 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
543 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
544 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
545 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
546 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
547 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
548 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
549 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
550 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
551 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
552 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
553 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
554 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
555 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
556 dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
557 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
558 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
559 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
560 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
561 info->src += info->src_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
562 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
563 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
564 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
565 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
566 static void SDL_Blit_RGB888_BGR888_Blend_Scale(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
567 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
568 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
569 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
570 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
571 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
572 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
573 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
574 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
575 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
576 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
577 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
578 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
579 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
580 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
581 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
582 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
583 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
584 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
585 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
586 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
587 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
588 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
589 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
590 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
591 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
592 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
593 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
594 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
595 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
596 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
597 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
598 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
599 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
600 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
601 srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
602 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
603 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
604 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
605 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
606 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
607 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
608 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
609 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
610 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
611 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
612 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
613 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
614 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
615 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
616 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
617 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
618 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
619 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
620 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
621 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
622 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
623 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
624 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
625 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
626 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
627 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
628 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
629 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
630 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
631 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
632 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
633 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
634 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
635 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
636 dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
637 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
638 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
639 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
640 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
641 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
642 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
643 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
644 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
645 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
646 static void SDL_Blit_RGB888_BGR888_Modulate(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
647 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
648 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
649 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
650 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
651 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
652 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
653 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
654 Uint32 R, G, B, A; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
655 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
656 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
657 Uint32 *src = (Uint32 *)info->src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
658 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
659 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
660 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
661 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
662 R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; A = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
663 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
664 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
665 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
666 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
667 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
668 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
669 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
670 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
671 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
672 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
673 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
674 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
675 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
676 info->src += info->src_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
677 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
678 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
679 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
680 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
681 static void SDL_Blit_RGB888_BGR888_Modulate_Scale(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
682 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
683 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
684 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
685 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
686 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
687 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
688 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
689 Uint32 R, G, B, A; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
690 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
691 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
692 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
693 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
694 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
695 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
696 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
697 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
698 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
699 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
700 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
701 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
702 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
703 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
704 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
705 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
706 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
707 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
708 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
709 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
710 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
711 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
712 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
713 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
714 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
715 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
716 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
717 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
718 R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; A = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
719 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
720 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
721 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
722 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
723 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
724 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
725 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
726 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
727 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
728 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
729 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
730 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
731 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
732 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
733 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
734 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
735 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
736 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
737 static void SDL_Blit_RGB888_BGR888_Modulate_Blend(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
738 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
739 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
740 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
741 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
742 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
743 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
744 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
745 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
746 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
747 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
748 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
749 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
750 Uint32 *src = (Uint32 *)info->src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
751 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
752 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
753 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
754 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
755 srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
756 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
757 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
758 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
759 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
760 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
761 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
762 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
763 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
764 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
765 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
766 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
767 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
768 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
769 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
770 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
771 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
772 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
773 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
774 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
775 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
776 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
777 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
778 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
779 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
780 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
781 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
782 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
783 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
784 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
785 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
786 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
787 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
788 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
789 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
790 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
791 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
792 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
793 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
794 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
795 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
796 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
797 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
798 dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
799 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
800 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
801 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
802 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
803 info->src += info->src_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
804 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
805 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
806 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
807 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
808 static void SDL_Blit_RGB888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
809 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
810 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
811 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
812 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
813 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
814 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
815 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
816 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
817 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
818 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
819 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
820 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
821 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
822 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
823 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
824 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
825 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
826 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
827 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
828 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
829 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
830 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
831 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
832 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
833 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
834 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
835 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
836 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
837 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
838 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
839 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
840 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
841 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
842 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
843 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
844 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
845 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
846 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
847 srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
848 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
849 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
850 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
851 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
852 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
853 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
854 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
855 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
856 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
857 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
858 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
859 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
860 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
861 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
862 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
863 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
864 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
865 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
866 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
867 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
868 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
869 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
870 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
871 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
872 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
873 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
874 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
875 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
876 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
877 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
878 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
879 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
880 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
881 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
882 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
883 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
884 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
885 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
886 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
887 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
888 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
889 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
890 dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
891 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
892 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
893 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
894 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
895 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
896 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
897 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
898 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
899 |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
900 static void SDL_Blit_RGB888_ARGB8888_Scale(SDL_BlitInfo *info) |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
901 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
902 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
903 Uint32 pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
904 Uint32 R, G, B, A; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
905 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
906 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
907 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
908 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
909 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
910 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
911 incy = (info->src_h << 16) / info->dst_h; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
912 incx = (info->src_w << 16) / info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
913 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
914 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
915 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
916 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
917 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
918 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
919 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
920 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
921 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
922 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
923 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
924 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
925 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
926 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
927 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
928 posx -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
929 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
930 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
931 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
932 pixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
933 R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; A = 0xFF; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
934 pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
935 *dst = pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
936 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
937 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
938 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
939 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
940 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
941 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
942 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
943 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
944 static void SDL_Blit_RGB888_ARGB8888_Blend(SDL_BlitInfo *info) |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
945 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
946 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
947 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
948 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
949 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
950 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
951 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
952 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
953 Uint32 *src = (Uint32 *)info->src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
954 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
955 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
956 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
957 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
958 srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
959 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
960 dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
961 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
962 /* This goes away if we ever use premultiplied alpha */ |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
963 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
964 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
965 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
966 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
967 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
968 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
969 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
970 case SDL_COPY_MASK: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
971 if (srcA) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
972 dstR = srcR; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
973 dstG = srcG; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
974 dstB = srcB; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
975 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
976 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
977 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
978 dstR = srcR + ((255 - srcA) * dstR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
979 dstG = srcG + ((255 - srcA) * dstG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
980 dstB = srcB + ((255 - srcA) * dstB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
981 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
982 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
983 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
984 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
985 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
986 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
987 case SDL_COPY_MOD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
988 dstR = (srcR * dstR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
989 dstG = (srcG * dstG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
990 dstB = (srcB * dstB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
991 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
992 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
993 dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
994 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
995 ++src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
996 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
997 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
998 info->src += info->src_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
999 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1000 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1001 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1002 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1003 static void SDL_Blit_RGB888_ARGB8888_Blend_Scale(SDL_BlitInfo *info) |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1004 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1005 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1006 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1007 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1008 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1009 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1010 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1011 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1012 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1013 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1014 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1015 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1016 incy = (info->src_h << 16) / info->dst_h; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1017 incx = (info->src_w << 16) / info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1018 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1019 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1020 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1021 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1022 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1023 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1024 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1025 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1026 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1027 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1028 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1029 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1030 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1031 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1032 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1033 posx -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1034 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1035 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1036 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1037 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1038 srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1039 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1040 dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1041 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1042 /* This goes away if we ever use premultiplied alpha */ |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1043 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1044 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1045 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1046 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1047 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1048 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1049 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1050 case SDL_COPY_MASK: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1051 if (srcA) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1052 dstR = srcR; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1053 dstG = srcG; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1054 dstB = srcB; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1055 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1056 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1057 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1058 dstR = srcR + ((255 - srcA) * dstR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1059 dstG = srcG + ((255 - srcA) * dstG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1060 dstB = srcB + ((255 - srcA) * dstB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1061 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1062 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1063 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1064 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1065 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1066 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1067 case SDL_COPY_MOD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1068 dstR = (srcR * dstR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1069 dstG = (srcG * dstG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1070 dstB = (srcB * dstB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1071 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1072 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1073 dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1074 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1075 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1076 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1077 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1078 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1079 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1080 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1081 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1082 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1083 static void SDL_Blit_RGB888_ARGB8888_Modulate(SDL_BlitInfo *info) |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1084 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1085 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1086 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1087 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1088 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1089 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1090 Uint32 pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1091 Uint32 R, G, B, A; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1092 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1093 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1094 Uint32 *src = (Uint32 *)info->src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1095 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1096 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1097 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1098 pixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1099 R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; A = 0xFF; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1100 if (flags & SDL_COPY_MODULATE_COLOR) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1101 R = (R * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1102 G = (G * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1103 B = (B * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1104 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1105 if (flags & SDL_COPY_MODULATE_ALPHA) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1106 A = (A * modulateA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1107 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1108 pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1109 *dst = pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1110 ++src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1111 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1112 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1113 info->src += info->src_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1114 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1115 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1116 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1117 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1118 static void SDL_Blit_RGB888_ARGB8888_Modulate_Scale(SDL_BlitInfo *info) |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1119 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1120 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1121 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1122 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1123 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1124 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1125 Uint32 pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1126 Uint32 R, G, B, A; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1127 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1128 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1129 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1130 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1131 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1132 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1133 incy = (info->src_h << 16) / info->dst_h; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1134 incx = (info->src_w << 16) / info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1135 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1136 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1137 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1138 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1139 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1140 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1141 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1142 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1143 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1144 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1145 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1146 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1147 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1148 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1149 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1150 posx -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1151 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1152 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1153 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1154 pixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1155 R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; A = 0xFF; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1156 if (flags & SDL_COPY_MODULATE_COLOR) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1157 R = (R * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1158 G = (G * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1159 B = (B * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1160 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1161 if (flags & SDL_COPY_MODULATE_ALPHA) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1162 A = (A * modulateA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1163 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1164 pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1165 *dst = pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1166 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1167 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1168 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1169 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1170 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1171 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1172 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1173 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1174 static void SDL_Blit_RGB888_ARGB8888_Modulate_Blend(SDL_BlitInfo *info) |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1175 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1176 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1177 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1178 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1179 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1180 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1181 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1182 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1183 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1184 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1185 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1186 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1187 Uint32 *src = (Uint32 *)info->src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1188 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1189 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1190 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1191 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1192 srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1193 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1194 dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1195 if (flags & SDL_COPY_MODULATE_COLOR) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1196 srcR = (srcR * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1197 srcG = (srcG * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1198 srcB = (srcB * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1199 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1200 if (flags & SDL_COPY_MODULATE_ALPHA) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1201 srcA = (srcA * modulateA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1202 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1203 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1204 /* This goes away if we ever use premultiplied alpha */ |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1205 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1206 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1207 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1208 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1209 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1210 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1211 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1212 case SDL_COPY_MASK: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1213 if (srcA) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1214 dstR = srcR; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1215 dstG = srcG; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1216 dstB = srcB; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1217 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1218 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1219 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1220 dstR = srcR + ((255 - srcA) * dstR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1221 dstG = srcG + ((255 - srcA) * dstG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1222 dstB = srcB + ((255 - srcA) * dstB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1223 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1224 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1225 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1226 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1227 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1228 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1229 case SDL_COPY_MOD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1230 dstR = (srcR * dstR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1231 dstG = (srcG * dstG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1232 dstB = (srcB * dstB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1233 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1234 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1235 dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1236 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1237 ++src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1238 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1239 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1240 info->src += info->src_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1241 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1242 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1243 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1244 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1245 static void SDL_Blit_RGB888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info) |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1246 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1247 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1248 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1249 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1250 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1251 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1252 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1253 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1254 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1255 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1256 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1257 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1258 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1259 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1260 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1261 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1262 incy = (info->src_h << 16) / info->dst_h; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1263 incx = (info->src_w << 16) / info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1264 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1265 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1266 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1267 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1268 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1269 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1270 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1271 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1272 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1273 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1274 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1275 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1276 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1277 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1278 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1279 posx -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1280 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1281 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1282 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1283 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1284 srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1285 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1286 dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1287 if (flags & SDL_COPY_MODULATE_COLOR) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1288 srcR = (srcR * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1289 srcG = (srcG * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1290 srcB = (srcB * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1291 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1292 if (flags & SDL_COPY_MODULATE_ALPHA) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1293 srcA = (srcA * modulateA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1294 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1295 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1296 /* This goes away if we ever use premultiplied alpha */ |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1297 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1298 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1299 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1300 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1301 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1302 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1303 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1304 case SDL_COPY_MASK: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1305 if (srcA) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1306 dstR = srcR; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1307 dstG = srcG; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1308 dstB = srcB; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1309 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1310 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1311 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1312 dstR = srcR + ((255 - srcA) * dstR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1313 dstG = srcG + ((255 - srcA) * dstG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1314 dstB = srcB + ((255 - srcA) * dstB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1315 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1316 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1317 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1318 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1319 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1320 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1321 case SDL_COPY_MOD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1322 dstR = (srcR * dstR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1323 dstG = (srcG * dstG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1324 dstB = (srcB * dstB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1325 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1326 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1327 dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1328 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1329 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1330 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1331 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1332 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1333 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1334 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1335 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1336 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
1337 static void SDL_Blit_BGR888_RGB888_Scale(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1338 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1339 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1340 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1341 Uint32 R, G, B, A; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1342 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1343 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1344 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1345 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1346 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1347 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1348 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1349 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1350 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1351 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1352 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1353 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1354 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1355 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1356 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1357 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1358 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1359 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1360 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1361 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1362 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1363 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1364 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1365 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1366 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1367 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1368 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1369 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1370 B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; A = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1371 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1372 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1373 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1374 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1375 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1376 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1377 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1378 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1379 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1380 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
1381 static void SDL_Blit_BGR888_RGB888_Blend(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1382 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1383 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1384 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1385 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1386 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1387 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1388 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1389 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1390 Uint32 *src = (Uint32 *)info->src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1391 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1392 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1393 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1394 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1395 srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1396 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1397 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1398 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1399 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1400 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1401 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1402 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1403 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1404 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1405 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1406 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1407 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1408 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1409 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1410 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1411 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1412 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1413 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1414 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1415 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1416 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1417 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1418 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1419 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1420 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1421 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1422 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1423 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1424 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1425 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1426 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1427 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1428 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1429 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1430 dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1431 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1432 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1433 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1434 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1435 info->src += info->src_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1436 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1437 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1438 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1439 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
1440 static void SDL_Blit_BGR888_RGB888_Blend_Scale(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1441 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1442 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1443 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1444 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1445 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1446 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1447 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1448 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1449 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1450 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1451 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1452 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1453 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1454 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1455 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1456 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1457 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1458 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1459 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1460 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1461 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1462 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1463 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1464 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1465 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1466 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1467 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1468 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1469 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1470 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1471 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1472 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1473 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1474 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1475 srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1476 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1477 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1478 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1479 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1480 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1481 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1482 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1483 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1484 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1485 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1486 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1487 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1488 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1489 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1490 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1491 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1492 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1493 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1494 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1495 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1496 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1497 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1498 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1499 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1500 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1501 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1502 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1503 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1504 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1505 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1506 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1507 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1508 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1509 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1510 dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1511 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1512 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1513 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1514 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1515 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1516 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1517 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1518 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1519 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
1520 static void SDL_Blit_BGR888_RGB888_Modulate(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1521 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1522 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1523 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1524 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1525 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1526 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1527 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1528 Uint32 R, G, B, A; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1529 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1530 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1531 Uint32 *src = (Uint32 *)info->src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1532 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1533 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1534 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1535 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1536 B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; A = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1537 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1538 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1539 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1540 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1541 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1542 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1543 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1544 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1545 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1546 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1547 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1548 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1549 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1550 info->src += info->src_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1551 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1552 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1553 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1554 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
1555 static void SDL_Blit_BGR888_RGB888_Modulate_Scale(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1556 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1557 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1558 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1559 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1560 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1561 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1562 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1563 Uint32 R, G, B, A; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1564 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1565 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1566 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1567 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1568 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1569 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1570 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1571 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1572 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1573 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1574 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1575 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1576 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1577 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1578 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1579 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1580 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1581 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1582 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1583 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1584 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1585 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1586 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1587 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1588 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1589 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1590 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1591 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1592 B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; A = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1593 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1594 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1595 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1596 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1597 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1598 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1599 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1600 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1601 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1602 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1603 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1604 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1605 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1606 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1607 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1608 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1609 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1610 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
1611 static void SDL_Blit_BGR888_RGB888_Modulate_Blend(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1612 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1613 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1614 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1615 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1616 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1617 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1618 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1619 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1620 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1621 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1622 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1623 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1624 Uint32 *src = (Uint32 *)info->src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1625 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1626 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1627 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1628 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1629 srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1630 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1631 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1632 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1633 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1634 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1635 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1636 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1637 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1638 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1639 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1640 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1641 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1642 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1643 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1644 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1645 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1646 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1647 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1648 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1649 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1650 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1651 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1652 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1653 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1654 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1655 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1656 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1657 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1658 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1659 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1660 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1661 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1662 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1663 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1664 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1665 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1666 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1667 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1668 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1669 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1670 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1671 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1672 dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1673 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1674 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1675 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1676 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1677 info->src += info->src_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1678 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1679 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1680 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1681 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
1682 static void SDL_Blit_BGR888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1683 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1684 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1685 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1686 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1687 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1688 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1689 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1690 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1691 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1692 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1693 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1694 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1695 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1696 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1697 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1698 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1699 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1700 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1701 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1702 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1703 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1704 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1705 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1706 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1707 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1708 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1709 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1710 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1711 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1712 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1713 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1714 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1715 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1716 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1717 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1718 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1719 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1720 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1721 srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1722 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1723 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1724 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1725 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1726 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1727 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1728 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1729 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1730 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1731 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1732 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1733 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1734 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1735 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1736 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1737 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1738 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1739 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1740 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1741 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1742 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1743 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1744 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1745 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1746 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1747 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1748 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1749 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1750 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1751 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1752 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1753 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1754 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1755 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1756 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1757 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1758 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1759 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1760 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1761 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1762 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1763 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1764 dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1765 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1766 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1767 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1768 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1769 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1770 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1771 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1772 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1773 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
1774 static void SDL_Blit_BGR888_BGR888_Scale(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1775 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1776 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1777 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1778 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1779 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1780 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1781 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1782 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1783 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1784 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1785 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1786 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1787 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1788 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1789 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1790 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1791 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1792 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1793 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1794 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1795 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1796 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1797 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1798 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1799 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1800 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1801 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1802 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1803 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1804 *dst = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1805 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1806 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1807 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1808 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1809 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1810 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1811 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1812 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
1813 static void SDL_Blit_BGR888_BGR888_Blend(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1814 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1815 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1816 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1817 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1818 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1819 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1820 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1821 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1822 Uint32 *src = (Uint32 *)info->src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1823 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1824 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1825 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1826 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1827 srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1828 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1829 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1830 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1831 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1832 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1833 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1834 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1835 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1836 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1837 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1838 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1839 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1840 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1841 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1842 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1843 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1844 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1845 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1846 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1847 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1848 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1849 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1850 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1851 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1852 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1853 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1854 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1855 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1856 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1857 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1858 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1859 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1860 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1861 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1862 dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1863 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1864 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1865 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1866 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1867 info->src += info->src_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1868 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1869 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1870 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1871 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
1872 static void SDL_Blit_BGR888_BGR888_Blend_Scale(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1873 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1874 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1875 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1876 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1877 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1878 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1879 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1880 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1881 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1882 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1883 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1884 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1885 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1886 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1887 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1888 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1889 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1890 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1891 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1892 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1893 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1894 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1895 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1896 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1897 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1898 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1899 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1900 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1901 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1902 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1903 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1904 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1905 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1906 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1907 srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1908 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1909 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1910 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1911 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1912 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1913 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1914 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1915 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1916 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1917 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1918 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1919 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1920 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1921 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1922 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1923 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1924 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1925 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1926 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1927 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1928 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1929 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1930 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1931 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1932 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1933 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1934 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1935 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1936 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1937 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1938 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1939 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1940 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1941 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1942 dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1943 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1944 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1945 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1946 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1947 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1948 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1949 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1950 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1951 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
1952 static void SDL_Blit_BGR888_BGR888_Modulate(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1953 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1954 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1955 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1956 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1957 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1958 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1959 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1960 Uint32 R, G, B, A; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1961 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1962 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1963 Uint32 *src = (Uint32 *)info->src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1964 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1965 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1966 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1967 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1968 B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; A = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1969 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1970 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1971 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1972 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1973 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1974 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1975 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1976 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1977 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1978 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1979 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1980 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1981 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1982 info->src += info->src_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1983 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1984 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1985 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1986 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
1987 static void SDL_Blit_BGR888_BGR888_Modulate_Scale(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1988 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1989 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1990 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1991 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1992 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1993 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1994 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1995 Uint32 R, G, B, A; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1996 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1997 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1998 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1999 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2000 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2001 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2002 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2003 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2004 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2005 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2006 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2007 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2008 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2009 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2010 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2011 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2012 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2013 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2014 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2015 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2016 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2017 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2018 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2019 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2020 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2021 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2022 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2023 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2024 B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; A = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2025 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2026 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2027 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2028 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2029 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2030 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2031 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2032 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2033 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2034 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2035 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2036 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2037 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2038 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2039 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2040 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2041 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2042 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
2043 static void SDL_Blit_BGR888_BGR888_Modulate_Blend(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2044 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2045 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2046 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2047 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2048 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2049 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2050 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2051 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2052 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2053 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2054 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2055 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2056 Uint32 *src = (Uint32 *)info->src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2057 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2058 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2059 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2060 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2061 srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2062 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2063 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2064 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2065 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2066 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2067 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2068 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2069 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2070 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2071 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2072 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2073 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2074 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2075 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2076 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2077 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2078 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2079 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2080 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2081 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2082 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2083 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2084 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2085 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2086 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2087 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2088 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2089 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2090 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2091 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2092 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2093 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2094 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2095 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2096 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2097 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2098 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2099 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2100 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2101 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2102 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2103 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2104 dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2105 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2106 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2107 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2108 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2109 info->src += info->src_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2110 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2111 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2112 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2113 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
2114 static void SDL_Blit_BGR888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2115 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2116 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2117 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2118 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2119 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2120 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2121 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2122 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2123 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2124 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2125 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2126 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2127 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2128 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2129 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2130 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2131 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2132 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2133 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2134 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2135 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2136 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2137 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2138 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2139 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2140 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2141 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2142 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2143 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2144 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2145 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2146 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2147 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2148 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2149 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2150 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2151 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2152 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2153 srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2154 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2155 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2156 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2157 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2158 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2159 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2160 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2161 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2162 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2163 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2164 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2165 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2166 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2167 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2168 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2169 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2170 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2171 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2172 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2173 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2174 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2175 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2176 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2177 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2178 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2179 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2180 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2181 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2182 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2183 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2184 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2185 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2186 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2187 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2188 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2189 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2190 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2191 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2192 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2193 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2194 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2195 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2196 dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2197 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2198 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2199 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2200 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2201 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2202 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2203 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2204 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2205 |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2206 static void SDL_Blit_BGR888_ARGB8888_Scale(SDL_BlitInfo *info) |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2207 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2208 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2209 Uint32 pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2210 Uint32 R, G, B, A; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2211 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2212 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2213 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2214 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2215 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2216 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2217 incy = (info->src_h << 16) / info->dst_h; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2218 incx = (info->src_w << 16) / info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2219 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2220 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2221 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2222 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2223 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2224 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2225 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2226 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2227 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2228 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2229 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2230 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2231 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2232 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2233 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2234 posx -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2235 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2236 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2237 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2238 pixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2239 B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; A = 0xFF; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2240 pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2241 *dst = pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2242 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2243 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2244 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2245 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2246 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2247 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2248 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2249 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2250 static void SDL_Blit_BGR888_ARGB8888_Blend(SDL_BlitInfo *info) |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2251 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2252 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2253 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2254 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2255 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2256 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2257 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2258 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2259 Uint32 *src = (Uint32 *)info->src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2260 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2261 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2262 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2263 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2264 srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2265 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2266 dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2267 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2268 /* This goes away if we ever use premultiplied alpha */ |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2269 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2270 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2271 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2272 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2273 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2274 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2275 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2276 case SDL_COPY_MASK: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2277 if (srcA) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2278 dstR = srcR; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2279 dstG = srcG; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2280 dstB = srcB; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2281 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2282 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2283 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2284 dstR = srcR + ((255 - srcA) * dstR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2285 dstG = srcG + ((255 - srcA) * dstG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2286 dstB = srcB + ((255 - srcA) * dstB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2287 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2288 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2289 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2290 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2291 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2292 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2293 case SDL_COPY_MOD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2294 dstR = (srcR * dstR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2295 dstG = (srcG * dstG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2296 dstB = (srcB * dstB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2297 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2298 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2299 dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2300 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2301 ++src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2302 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2303 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2304 info->src += info->src_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2305 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2306 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2307 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2308 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2309 static void SDL_Blit_BGR888_ARGB8888_Blend_Scale(SDL_BlitInfo *info) |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2310 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2311 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2312 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2313 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2314 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2315 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2316 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2317 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2318 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2319 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2320 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2321 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2322 incy = (info->src_h << 16) / info->dst_h; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2323 incx = (info->src_w << 16) / info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2324 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2325 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2326 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2327 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2328 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2329 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2330 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2331 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2332 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2333 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2334 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2335 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2336 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2337 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2338 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2339 posx -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2340 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2341 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2342 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2343 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2344 srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2345 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2346 dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2347 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2348 /* This goes away if we ever use premultiplied alpha */ |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2349 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2350 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2351 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2352 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2353 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2354 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2355 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2356 case SDL_COPY_MASK: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2357 if (srcA) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2358 dstR = srcR; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2359 dstG = srcG; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2360 dstB = srcB; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2361 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2362 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2363 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2364 dstR = srcR + ((255 - srcA) * dstR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2365 dstG = srcG + ((255 - srcA) * dstG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2366 dstB = srcB + ((255 - srcA) * dstB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2367 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2368 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2369 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2370 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2371 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2372 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2373 case SDL_COPY_MOD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2374 dstR = (srcR * dstR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2375 dstG = (srcG * dstG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2376 dstB = (srcB * dstB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2377 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2378 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2379 dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2380 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2381 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2382 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2383 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2384 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2385 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2386 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2387 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2388 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2389 static void SDL_Blit_BGR888_ARGB8888_Modulate(SDL_BlitInfo *info) |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2390 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2391 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2392 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2393 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2394 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2395 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2396 Uint32 pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2397 Uint32 R, G, B, A; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2398 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2399 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2400 Uint32 *src = (Uint32 *)info->src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2401 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2402 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2403 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2404 pixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2405 B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; A = 0xFF; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2406 if (flags & SDL_COPY_MODULATE_COLOR) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2407 R = (R * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2408 G = (G * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2409 B = (B * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2410 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2411 if (flags & SDL_COPY_MODULATE_ALPHA) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2412 A = (A * modulateA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2413 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2414 pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2415 *dst = pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2416 ++src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2417 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2418 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2419 info->src += info->src_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2420 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2421 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2422 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2423 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2424 static void SDL_Blit_BGR888_ARGB8888_Modulate_Scale(SDL_BlitInfo *info) |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2425 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2426 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2427 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2428 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2429 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2430 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2431 Uint32 pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2432 Uint32 R, G, B, A; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2433 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2434 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2435 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2436 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2437 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2438 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2439 incy = (info->src_h << 16) / info->dst_h; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2440 incx = (info->src_w << 16) / info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2441 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2442 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2443 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2444 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2445 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2446 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2447 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2448 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2449 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2450 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2451 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2452 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2453 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2454 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2455 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2456 posx -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2457 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2458 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2459 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2460 pixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2461 B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; A = 0xFF; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2462 if (flags & SDL_COPY_MODULATE_COLOR) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2463 R = (R * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2464 G = (G * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2465 B = (B * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2466 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2467 if (flags & SDL_COPY_MODULATE_ALPHA) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2468 A = (A * modulateA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2469 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2470 pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2471 *dst = pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2472 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2473 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2474 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2475 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2476 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2477 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2478 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2479 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2480 static void SDL_Blit_BGR888_ARGB8888_Modulate_Blend(SDL_BlitInfo *info) |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2481 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2482 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2483 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2484 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2485 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2486 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2487 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2488 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2489 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2490 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2491 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2492 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2493 Uint32 *src = (Uint32 *)info->src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2494 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2495 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2496 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2497 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2498 srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2499 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2500 dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2501 if (flags & SDL_COPY_MODULATE_COLOR) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2502 srcR = (srcR * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2503 srcG = (srcG * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2504 srcB = (srcB * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2505 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2506 if (flags & SDL_COPY_MODULATE_ALPHA) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2507 srcA = (srcA * modulateA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2508 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2509 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2510 /* This goes away if we ever use premultiplied alpha */ |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2511 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2512 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2513 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2514 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2515 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2516 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2517 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2518 case SDL_COPY_MASK: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2519 if (srcA) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2520 dstR = srcR; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2521 dstG = srcG; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2522 dstB = srcB; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2523 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2524 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2525 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2526 dstR = srcR + ((255 - srcA) * dstR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2527 dstG = srcG + ((255 - srcA) * dstG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2528 dstB = srcB + ((255 - srcA) * dstB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2529 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2530 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2531 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2532 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2533 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2534 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2535 case SDL_COPY_MOD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2536 dstR = (srcR * dstR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2537 dstG = (srcG * dstG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2538 dstB = (srcB * dstB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2539 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2540 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2541 dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2542 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2543 ++src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2544 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2545 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2546 info->src += info->src_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2547 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2548 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2549 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2550 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2551 static void SDL_Blit_BGR888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info) |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2552 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2553 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2554 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2555 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2556 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2557 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2558 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2559 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2560 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2561 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2562 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2563 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2564 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2565 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2566 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2567 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2568 incy = (info->src_h << 16) / info->dst_h; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2569 incx = (info->src_w << 16) / info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2570 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2571 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2572 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2573 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2574 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2575 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2576 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2577 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2578 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2579 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2580 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2581 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2582 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2583 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2584 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2585 posx -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2586 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2587 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2588 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2589 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2590 srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2591 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2592 dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2593 if (flags & SDL_COPY_MODULATE_COLOR) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2594 srcR = (srcR * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2595 srcG = (srcG * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2596 srcB = (srcB * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2597 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2598 if (flags & SDL_COPY_MODULATE_ALPHA) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2599 srcA = (srcA * modulateA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2600 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2601 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2602 /* This goes away if we ever use premultiplied alpha */ |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2603 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2604 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2605 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2606 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2607 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2608 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2609 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2610 case SDL_COPY_MASK: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2611 if (srcA) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2612 dstR = srcR; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2613 dstG = srcG; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2614 dstB = srcB; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2615 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2616 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2617 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2618 dstR = srcR + ((255 - srcA) * dstR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2619 dstG = srcG + ((255 - srcA) * dstG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2620 dstB = srcB + ((255 - srcA) * dstB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2621 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2622 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2623 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2624 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2625 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2626 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2627 case SDL_COPY_MOD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2628 dstR = (srcR * dstR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2629 dstG = (srcG * dstG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2630 dstB = (srcB * dstB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2631 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2632 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2633 dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2634 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2635 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2636 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2637 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2638 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2639 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2640 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2641 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2642 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
2643 static void SDL_Blit_ARGB8888_RGB888_Scale(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2644 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2645 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2646 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2647 Uint32 R, G, B, A; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2648 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2649 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2650 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2651 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2652 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2653 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2654 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2655 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2656 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2657 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2658 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2659 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2660 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2661 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2662 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2663 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2664 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2665 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2666 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2667 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2668 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2669 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2670 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2671 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2672 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2673 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2674 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2675 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2676 A = (Uint8)(pixel >> 24); R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2677 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2678 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2679 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2680 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2681 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2682 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2683 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2684 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2685 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2686 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
2687 static void SDL_Blit_ARGB8888_RGB888_Blend(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2688 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2689 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2690 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2691 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2692 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2693 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2694 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2695 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2696 Uint32 *src = (Uint32 *)info->src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2697 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2698 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2699 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2700 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2701 srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2702 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2703 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2704 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2705 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2706 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2707 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2708 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2709 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2710 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2711 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2712 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2713 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2714 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2715 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2716 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2717 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2718 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2719 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2720 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2721 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2722 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2723 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2724 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2725 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2726 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2727 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2728 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2729 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2730 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2731 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2732 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2733 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2734 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2735 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2736 dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2737 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2738 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2739 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2740 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2741 info->src += info->src_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2742 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2743 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2744 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2745 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
2746 static void SDL_Blit_ARGB8888_RGB888_Blend_Scale(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2747 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2748 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2749 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2750 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2751 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2752 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2753 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2754 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2755 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2756 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2757 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2758 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2759 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2760 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2761 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2762 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2763 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2764 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2765 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2766 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2767 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2768 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2769 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2770 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2771 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2772 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2773 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2774 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2775 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2776 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2777 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2778 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2779 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2780 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2781 srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2782 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2783 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2784 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2785 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2786 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2787 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2788 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2789 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2790 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2791 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2792 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2793 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2794 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2795 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2796 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2797 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2798 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2799 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2800 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2801 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2802 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2803 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2804 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2805 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2806 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2807 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2808 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2809 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2810 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2811 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2812 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2813 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2814 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2815 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2816 dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2817 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2818 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2819 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2820 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2821 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2822 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2823 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2824 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2825 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
2826 static void SDL_Blit_ARGB8888_RGB888_Modulate(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2827 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2828 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2829 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2830 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2831 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2832 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2833 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2834 Uint32 R, G, B, A; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2835 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2836 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2837 Uint32 *src = (Uint32 *)info->src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2838 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2839 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2840 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2841 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2842 A = (Uint8)(pixel >> 24); R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2843 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2844 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2845 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2846 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2847 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2848 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2849 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2850 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2851 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2852 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2853 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2854 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2855 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2856 info->src += info->src_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2857 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2858 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2859 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2860 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
2861 static void SDL_Blit_ARGB8888_RGB888_Modulate_Scale(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2862 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2863 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2864 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2865 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2866 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2867 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2868 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2869 Uint32 R, G, B, A; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2870 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2871 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2872 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2873 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2874 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2875 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2876 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2877 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2878 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2879 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2880 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2881 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2882 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2883 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2884 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2885 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2886 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2887 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2888 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2889 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2890 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2891 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2892 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2893 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2894 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2895 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2896 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2897 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2898 A = (Uint8)(pixel >> 24); R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2899 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2900 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2901 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2902 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2903 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2904 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2905 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2906 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2907 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2908 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2909 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2910 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2911 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2912 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2913 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2914 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2915 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2916 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
2917 static void SDL_Blit_ARGB8888_RGB888_Modulate_Blend(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2918 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2919 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2920 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2921 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2922 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2923 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2924 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2925 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2926 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2927 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2928 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2929 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2930 Uint32 *src = (Uint32 *)info->src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2931 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2932 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2933 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2934 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2935 srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2936 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2937 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2938 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2939 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2940 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2941 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2942 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2943 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2944 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2945 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2946 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2947 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2948 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2949 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2950 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2951 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2952 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2953 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2954 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2955 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2956 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2957 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2958 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2959 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2960 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2961 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2962 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2963 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2964 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2965 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2966 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2967 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2968 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2969 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2970 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2971 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2972 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2973 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2974 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2975 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2976 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2977 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2978 dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2979 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2980 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2981 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2982 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2983 info->src += info->src_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2984 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2985 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2986 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2987 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
2988 static void SDL_Blit_ARGB8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2989 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2990 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2991 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2992 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2993 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2994 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2995 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2996 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2997 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2998 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2999 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3000 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3001 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3002 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3003 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3004 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3005 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3006 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3007 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3008 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3009 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3010 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3011 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3012 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3013 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3014 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3015 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3016 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3017 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3018 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3019 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3020 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3021 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3022 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3023 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3024 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3025 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3026 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3027 srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3028 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3029 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3030 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3031 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3032 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3033 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3034 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3035 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3036 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3037 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3038 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3039 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3040 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3041 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3042 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3043 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3044 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3045 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3046 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3047 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3048 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3049 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3050 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3051 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3052 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3053 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3054 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3055 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3056 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3057 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3058 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3059 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3060 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3061 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3062 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3063 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3064 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3065 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3066 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3067 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3068 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3069 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3070 dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3071 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3072 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3073 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3074 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3075 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3076 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3077 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3078 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3079 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
3080 static void SDL_Blit_ARGB8888_BGR888_Scale(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3081 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3082 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3083 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3084 Uint32 R, G, B, A; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3085 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3086 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3087 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3088 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3089 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3090 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3091 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3092 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3093 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3094 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3095 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3096 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3097 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3098 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3099 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3100 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3101 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3102 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3103 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3104 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3105 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3106 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3107 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3108 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3109 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3110 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3111 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3112 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3113 A = (Uint8)(pixel >> 24); R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3114 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3115 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3116 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3117 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3118 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3119 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3120 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3121 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3122 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3123 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
3124 static void SDL_Blit_ARGB8888_BGR888_Blend(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3125 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3126 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3127 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3128 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3129 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3130 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3131 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3132 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3133 Uint32 *src = (Uint32 *)info->src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3134 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3135 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3136 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3137 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3138 srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3139 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3140 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3141 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3142 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3143 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3144 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3145 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3146 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3147 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3148 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3149 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3150 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3151 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3152 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3153 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3154 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3155 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3156 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3157 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3158 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3159 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3160 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3161 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3162 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3163 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3164 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3165 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3166 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3167 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3168 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3169 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3170 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3171 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3172 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3173 dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3174 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3175 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3176 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3177 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3178 info->src += info->src_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3179 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3180 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3181 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3182 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
3183 static void SDL_Blit_ARGB8888_BGR888_Blend_Scale(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3184 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3185 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3186 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3187 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3188 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3189 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3190 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3191 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3192 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3193 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3194 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3195 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3196 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3197 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3198 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3199 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3200 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3201 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3202 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3203 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3204 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3205 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3206 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3207 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3208 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3209 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3210 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3211 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3212 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3213 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3214 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3215 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3216 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3217 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3218 srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3219 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3220 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3221 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3222 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3223 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3224 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3225 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3226 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3227 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3228 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3229 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3230 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3231 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3232 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3233 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3234 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3235 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3236 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3237 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3238 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3239 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3240 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3241 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3242 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3243 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3244 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3245 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3246 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3247 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3248 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3249 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3250 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3251 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3252 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3253 dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3254 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3255 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3256 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3257 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3258 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3259 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3260 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3261 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3262 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
3263 static void SDL_Blit_ARGB8888_BGR888_Modulate(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3264 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3265 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3266 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3267 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3268 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3269 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3270 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3271 Uint32 R, G, B, A; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3272 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3273 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3274 Uint32 *src = (Uint32 *)info->src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3275 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3276 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3277 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3278 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3279 A = (Uint8)(pixel >> 24); R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3280 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3281 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3282 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3283 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3284 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3285 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3286 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3287 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3288 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3289 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3290 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3291 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3292 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3293 info->src += info->src_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3294 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3295 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3296 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3297 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
3298 static void SDL_Blit_ARGB8888_BGR888_Modulate_Scale(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3299 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3300 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3301 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3302 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3303 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3304 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3305 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3306 Uint32 R, G, B, A; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3307 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3308 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3309 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3310 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3311 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3312 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3313 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3314 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3315 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3316 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3317 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3318 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3319 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3320 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3321 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3322 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3323 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3324 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3325 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3326 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3327 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3328 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3329 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3330 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3331 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3332 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3333 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3334 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3335 A = (Uint8)(pixel >> 24); R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3336 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3337 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3338 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3339 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3340 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3341 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3342 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3343 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3344 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3345 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3346 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3347 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3348 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3349 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3350 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3351 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3352 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3353 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
3354 static void SDL_Blit_ARGB8888_BGR888_Modulate_Blend(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3355 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3356 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3357 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3358 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3359 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3360 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3361 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3362 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3363 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3364 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3365 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3366 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3367 Uint32 *src = (Uint32 *)info->src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3368 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3369 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3370 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3371 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3372 srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3373 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3374 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3375 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3376 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3377 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3378 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3379 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3380 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3381 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3382 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3383 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3384 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3385 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3386 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3387 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3388 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3389 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3390 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3391 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3392 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3393 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3394 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3395 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3396 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3397 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3398 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3399 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3400 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3401 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3402 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3403 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3404 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3405 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3406 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3407 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3408 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3409 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3410 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3411 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3412 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3413 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3414 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3415 dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3416 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3417 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3418 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3419 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3420 info->src += info->src_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3421 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3422 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3423 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3424 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
3425 static void SDL_Blit_ARGB8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3426 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3427 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3428 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3429 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3430 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3431 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3432 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3433 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3434 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3435 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3436 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3437 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3438 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3439 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3440 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3441 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3442 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3443 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3444 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3445 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3446 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3447 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3448 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3449 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3450 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3451 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3452 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3453 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3454 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3455 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3456 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3457 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3458 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3459 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3460 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3461 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3462 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3463 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3464 srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3465 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3466 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3467 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3468 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3469 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3470 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3471 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3472 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3473 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3474 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3475 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3476 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3477 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3478 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3479 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3480 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3481 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3482 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3483 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3484 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3485 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3486 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3487 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3488 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3489 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3490 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3491 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3492 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3493 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3494 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3495 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3496 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3497 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3498 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3499 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3500 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3501 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3502 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3503 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3504 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3505 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3506 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3507 dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3508 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3509 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3510 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3511 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3512 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3513 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3514 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3515 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3516 |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3517 static void SDL_Blit_ARGB8888_ARGB8888_Scale(SDL_BlitInfo *info) |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3518 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3519 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3520 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3521 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3522 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3523 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3524 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3525 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3526 incy = (info->src_h << 16) / info->dst_h; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3527 incx = (info->src_w << 16) / info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3528 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3529 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3530 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3531 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3532 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3533 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3534 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3535 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3536 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3537 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3538 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3539 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3540 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3541 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3542 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3543 posx -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3544 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3545 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3546 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3547 *dst = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3548 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3549 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3550 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3551 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3552 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3553 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3554 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3555 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3556 static void SDL_Blit_ARGB8888_ARGB8888_Blend(SDL_BlitInfo *info) |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3557 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3558 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3559 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3560 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3561 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3562 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3563 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3564 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3565 Uint32 *src = (Uint32 *)info->src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3566 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3567 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3568 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3569 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3570 srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3571 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3572 dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3573 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3574 /* This goes away if we ever use premultiplied alpha */ |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3575 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3576 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3577 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3578 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3579 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3580 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3581 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3582 case SDL_COPY_MASK: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3583 if (srcA) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3584 dstR = srcR; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3585 dstG = srcG; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3586 dstB = srcB; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3587 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3588 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3589 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3590 dstR = srcR + ((255 - srcA) * dstR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3591 dstG = srcG + ((255 - srcA) * dstG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3592 dstB = srcB + ((255 - srcA) * dstB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3593 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3594 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3595 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3596 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3597 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3598 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3599 case SDL_COPY_MOD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3600 dstR = (srcR * dstR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3601 dstG = (srcG * dstG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3602 dstB = (srcB * dstB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3603 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3604 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3605 dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3606 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3607 ++src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3608 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3609 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3610 info->src += info->src_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3611 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3612 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3613 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3614 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3615 static void SDL_Blit_ARGB8888_ARGB8888_Blend_Scale(SDL_BlitInfo *info) |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3616 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3617 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3618 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3619 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3620 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3621 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3622 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3623 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3624 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3625 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3626 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3627 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3628 incy = (info->src_h << 16) / info->dst_h; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3629 incx = (info->src_w << 16) / info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3630 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3631 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3632 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3633 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3634 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3635 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3636 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3637 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3638 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3639 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3640 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3641 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3642 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3643 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3644 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3645 posx -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3646 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3647 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3648 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3649 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3650 srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3651 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3652 dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3653 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3654 /* This goes away if we ever use premultiplied alpha */ |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3655 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3656 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3657 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3658 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3659 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3660 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3661 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3662 case SDL_COPY_MASK: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3663 if (srcA) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3664 dstR = srcR; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3665 dstG = srcG; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3666 dstB = srcB; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3667 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3668 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3669 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3670 dstR = srcR + ((255 - srcA) * dstR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3671 dstG = srcG + ((255 - srcA) * dstG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3672 dstB = srcB + ((255 - srcA) * dstB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3673 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3674 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3675 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3676 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3677 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3678 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3679 case SDL_COPY_MOD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3680 dstR = (srcR * dstR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3681 dstG = (srcG * dstG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3682 dstB = (srcB * dstB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3683 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3684 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3685 dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3686 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3687 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3688 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3689 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3690 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3691 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3692 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3693 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3694 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3695 static void SDL_Blit_ARGB8888_ARGB8888_Modulate(SDL_BlitInfo *info) |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3696 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3697 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3698 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3699 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3700 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3701 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3702 Uint32 pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3703 Uint32 R, G, B, A; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3704 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3705 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3706 Uint32 *src = (Uint32 *)info->src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3707 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3708 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3709 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3710 pixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3711 A = (Uint8)(pixel >> 24); R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3712 if (flags & SDL_COPY_MODULATE_COLOR) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3713 R = (R * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3714 G = (G * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3715 B = (B * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3716 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3717 if (flags & SDL_COPY_MODULATE_ALPHA) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3718 A = (A * modulateA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3719 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3720 pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3721 *dst = pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3722 ++src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3723 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3724 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3725 info->src += info->src_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3726 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3727 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3728 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3729 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3730 static void SDL_Blit_ARGB8888_ARGB8888_Modulate_Scale(SDL_BlitInfo *info) |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3731 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3732 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3733 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3734 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3735 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3736 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3737 Uint32 pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3738 Uint32 R, G, B, A; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3739 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3740 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3741 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3742 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3743 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3744 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3745 incy = (info->src_h << 16) / info->dst_h; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3746 incx = (info->src_w << 16) / info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3747 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3748 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3749 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3750 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3751 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3752 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3753 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3754 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3755 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3756 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3757 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3758 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3759 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3760 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3761 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3762 posx -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3763 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3764 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3765 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3766 pixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3767 A = (Uint8)(pixel >> 24); R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3768 if (flags & SDL_COPY_MODULATE_COLOR) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3769 R = (R * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3770 G = (G * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3771 B = (B * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3772 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3773 if (flags & SDL_COPY_MODULATE_ALPHA) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3774 A = (A * modulateA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3775 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3776 pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3777 *dst = pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3778 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3779 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3780 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3781 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3782 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3783 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3784 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3785 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3786 static void SDL_Blit_ARGB8888_ARGB8888_Modulate_Blend(SDL_BlitInfo *info) |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3787 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3788 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3789 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3790 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3791 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3792 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3793 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3794 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3795 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3796 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3797 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3798 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3799 Uint32 *src = (Uint32 *)info->src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3800 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3801 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3802 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3803 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3804 srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3805 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3806 dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3807 if (flags & SDL_COPY_MODULATE_COLOR) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3808 srcR = (srcR * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3809 srcG = (srcG * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3810 srcB = (srcB * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3811 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3812 if (flags & SDL_COPY_MODULATE_ALPHA) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3813 srcA = (srcA * modulateA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3814 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3815 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3816 /* This goes away if we ever use premultiplied alpha */ |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3817 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3818 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3819 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3820 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3821 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3822 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3823 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3824 case SDL_COPY_MASK: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3825 if (srcA) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3826 dstR = srcR; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3827 dstG = srcG; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3828 dstB = srcB; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3829 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3830 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3831 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3832 dstR = srcR + ((255 - srcA) * dstR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3833 dstG = srcG + ((255 - srcA) * dstG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3834 dstB = srcB + ((255 - srcA) * dstB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3835 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3836 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3837 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3838 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3839 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3840 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3841 case SDL_COPY_MOD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3842 dstR = (srcR * dstR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3843 dstG = (srcG * dstG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3844 dstB = (srcB * dstB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3845 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3846 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3847 dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3848 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3849 ++src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3850 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3851 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3852 info->src += info->src_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3853 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3854 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3855 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3856 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3857 static void SDL_Blit_ARGB8888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info) |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3858 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3859 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3860 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3861 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3862 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3863 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3864 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3865 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3866 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3867 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3868 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3869 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3870 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3871 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3872 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3873 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3874 incy = (info->src_h << 16) / info->dst_h; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3875 incx = (info->src_w << 16) / info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3876 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3877 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3878 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3879 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3880 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3881 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3882 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3883 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3884 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3885 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3886 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3887 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3888 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3889 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3890 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3891 posx -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3892 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3893 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3894 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3895 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3896 srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3897 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3898 dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3899 if (flags & SDL_COPY_MODULATE_COLOR) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3900 srcR = (srcR * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3901 srcG = (srcG * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3902 srcB = (srcB * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3903 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3904 if (flags & SDL_COPY_MODULATE_ALPHA) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3905 srcA = (srcA * modulateA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3906 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3907 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3908 /* This goes away if we ever use premultiplied alpha */ |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3909 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3910 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3911 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3912 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3913 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3914 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3915 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3916 case SDL_COPY_MASK: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3917 if (srcA) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3918 dstR = srcR; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3919 dstG = srcG; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3920 dstB = srcB; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3921 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3922 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3923 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3924 dstR = srcR + ((255 - srcA) * dstR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3925 dstG = srcG + ((255 - srcA) * dstG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3926 dstB = srcB + ((255 - srcA) * dstB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3927 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3928 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3929 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3930 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3931 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3932 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3933 case SDL_COPY_MOD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3934 dstR = (srcR * dstR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3935 dstG = (srcG * dstG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3936 dstB = (srcB * dstB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3937 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3938 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3939 dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3940 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3941 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3942 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3943 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3944 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3945 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3946 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3947 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3948 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
3949 static void SDL_Blit_RGBA8888_RGB888_Scale(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3950 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3951 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3952 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3953 Uint32 R, G, B, A; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3954 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3955 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3956 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3957 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3958 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3959 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3960 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3961 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3962 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3963 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3964 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3965 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3966 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3967 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3968 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3969 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3970 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3971 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3972 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3973 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3974 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3975 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3976 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3977 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3978 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3979 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3980 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3981 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3982 R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3983 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3984 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3985 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3986 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3987 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3988 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3989 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3990 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3991 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3992 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
3993 static void SDL_Blit_RGBA8888_RGB888_Blend(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3994 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3995 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3996 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3997 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3998 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3999 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4000 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4001 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4002 Uint32 *src = (Uint32 *)info->src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4003 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4004 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4005 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4006 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4007 srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4008 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4009 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4010 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4011 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4012 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4013 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4014 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4015 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4016 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4017 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4018 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4019 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4020 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4021 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4022 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4023 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4024 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4025 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4026 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4027 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4028 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4029 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4030 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4031 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4032 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4033 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4034 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4035 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4036 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4037 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4038 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4039 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4040 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4041 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4042 dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4043 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4044 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4045 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4046 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4047 info->src += info->src_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4048 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4049 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4050 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4051 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
4052 static void SDL_Blit_RGBA8888_RGB888_Blend_Scale(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4053 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4054 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4055 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4056 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4057 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4058 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4059 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4060 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4061 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4062 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4063 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4064 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4065 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4066 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4067 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4068 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4069 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4070 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4071 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4072 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4073 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4074 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4075 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4076 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4077 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4078 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4079 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4080 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4081 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4082 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4083 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4084 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4085 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4086 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4087 srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4088 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4089 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4090 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4091 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4092 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4093 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4094 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4095 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4096 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4097 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4098 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4099 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4100 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4101 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4102 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4103 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4104 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4105 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4106 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4107 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4108 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4109 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4110 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4111 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4112 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4113 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4114 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4115 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4116 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4117 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4118 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4119 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4120 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4121 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4122 dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4123 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4124 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4125 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4126 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4127 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4128 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4129 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4130 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4131 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
4132 static void SDL_Blit_RGBA8888_RGB888_Modulate(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4133 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4134 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4135 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4136 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4137 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4138 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4139 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4140 Uint32 R, G, B, A; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4141 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4142 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4143 Uint32 *src = (Uint32 *)info->src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4144 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4145 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4146 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4147 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4148 R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4149 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4150 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4151 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4152 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4153 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4154 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4155 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4156 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4157 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4158 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4159 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4160 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4161 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4162 info->src += info->src_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4163 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4164 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4165 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4166 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
4167 static void SDL_Blit_RGBA8888_RGB888_Modulate_Scale(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4168 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4169 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4170 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4171 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4172 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4173 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4174 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4175 Uint32 R, G, B, A; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4176 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4177 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4178 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4179 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4180 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4181 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4182 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4183 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4184 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4185 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4186 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4187 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4188 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4189 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4190 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4191 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4192 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4193 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4194 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4195 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4196 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4197 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4198 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4199 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4200 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4201 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4202 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4203 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4204 R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4205 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4206 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4207 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4208 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4209 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4210 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4211 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4212 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4213 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4214 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4215 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4216 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4217 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4218 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4219 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4220 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4221 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4222 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
4223 static void SDL_Blit_RGBA8888_RGB888_Modulate_Blend(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4224 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4225 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4226 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4227 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4228 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4229 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4230 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4231 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4232 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4233 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4234 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4235 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4236 Uint32 *src = (Uint32 *)info->src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4237 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4238 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4239 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4240 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4241 srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4242 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4243 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4244 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4245 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4246 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4247 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4248 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4249 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4250 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4251 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4252 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4253 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4254 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4255 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4256 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4257 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4258 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4259 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4260 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4261 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4262 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4263 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4264 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4265 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4266 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4267 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4268 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4269 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4270 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4271 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4272 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4273 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4274 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4275 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4276 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4277 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4278 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4279 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4280 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4281 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4282 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4283 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4284 dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4285 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4286 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4287 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4288 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4289 info->src += info->src_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4290 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4291 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4292 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4293 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
4294 static void SDL_Blit_RGBA8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4295 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4296 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4297 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4298 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4299 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4300 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4301 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4302 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4303 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4304 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4305 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4306 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4307 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4308 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4309 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4310 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4311 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4312 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4313 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4314 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4315 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4316 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4317 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4318 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4319 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4320 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4321 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4322 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4323 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4324 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4325 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4326 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4327 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4328 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4329 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4330 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4331 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4332 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4333 srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4334 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4335 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4336 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4337 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4338 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4339 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4340 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4341 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4342 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4343 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4344 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4345 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4346 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4347 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4348 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4349 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4350 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4351 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4352 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4353 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4354 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4355 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4356 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4357 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4358 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4359 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4360 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4361 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4362 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4363 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4364 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4365 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4366 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4367 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4368 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4369 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4370 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4371 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4372 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4373 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4374 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4375 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4376 dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4377 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4378 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4379 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4380 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4381 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4382 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4383 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4384 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4385 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
4386 static void SDL_Blit_RGBA8888_BGR888_Scale(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4387 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4388 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4389 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4390 Uint32 R, G, B, A; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4391 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4392 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4393 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4394 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4395 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4396 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4397 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4398 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4399 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4400 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4401 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4402 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4403 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4404 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4405 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4406 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4407 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4408 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4409 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4410 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4411 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4412 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4413 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4414 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4415 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4416 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4417 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4418 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4419 R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4420 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4421 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4422 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4423 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4424 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4425 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4426 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4427 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4428 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4429 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
4430 static void SDL_Blit_RGBA8888_BGR888_Blend(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4431 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4432 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4433 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4434 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4435 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4436 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4437 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4438 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4439 Uint32 *src = (Uint32 *)info->src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4440 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4441 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4442 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4443 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4444 srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4445 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4446 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4447 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4448 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4449 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4450 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4451 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4452 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4453 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4454 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4455 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4456 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4457 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4458 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4459 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4460 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4461 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4462 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4463 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4464 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4465 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4466 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4467 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4468 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4469 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4470 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4471 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4472 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4473 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4474 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4475 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4476 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4477 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4478 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4479 dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4480 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4481 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4482 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4483 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4484 info->src += info->src_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4485 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4486 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4487 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4488 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
4489 static void SDL_Blit_RGBA8888_BGR888_Blend_Scale(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4490 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4491 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4492 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4493 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4494 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4495 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4496 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4497 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4498 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4499 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4500 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4501 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4502 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4503 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4504 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4505 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4506 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4507 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4508 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4509 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4510 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4511 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4512 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4513 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4514 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4515 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4516 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4517 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4518 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4519 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4520 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4521 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4522 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4523 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4524 srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4525 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4526 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4527 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4528 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4529 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4530 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4531 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4532 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4533 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4534 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4535 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4536 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4537 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4538 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4539 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4540 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4541 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4542 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4543 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4544 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4545 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4546 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4547 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4548 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4549 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4550 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4551 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4552 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4553 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4554 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4555 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4556 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4557 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4558 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4559 dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4560 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4561 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4562 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4563 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4564 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4565 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4566 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4567 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4568 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
4569 static void SDL_Blit_RGBA8888_BGR888_Modulate(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4570 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4571 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4572 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4573 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4574 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4575 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4576 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4577 Uint32 R, G, B, A; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4578 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4579 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4580 Uint32 *src = (Uint32 *)info->src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4581 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4582 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4583 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4584 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4585 R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4586 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4587 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4588 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4589 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4590 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4591 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4592 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4593 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4594 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4595 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4596 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4597 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4598 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4599 info->src += info->src_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4600 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4601 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4602 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4603 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
4604 static void SDL_Blit_RGBA8888_BGR888_Modulate_Scale(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4605 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4606 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4607 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4608 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4609 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4610 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4611 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4612 Uint32 R, G, B, A; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4613 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4614 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4615 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4616 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4617 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4618 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4619 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4620 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4621 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4622 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4623 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4624 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4625 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4626 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4627 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4628 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4629 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4630 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4631 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4632 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4633 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4634 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4635 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4636 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4637 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4638 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4639 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4640 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4641 R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4642 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4643 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4644 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4645 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4646 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4647 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4648 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4649 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4650 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4651 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4652 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4653 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4654 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4655 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4656 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4657 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4658 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4659 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
4660 static void SDL_Blit_RGBA8888_BGR888_Modulate_Blend(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4661 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4662 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4663 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4664 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4665 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4666 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4667 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4668 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4669 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4670 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4671 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4672 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4673 Uint32 *src = (Uint32 *)info->src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4674 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4675 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4676 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4677 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4678 srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4679 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4680 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4681 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4682 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4683 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4684 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4685 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4686 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4687 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4688 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4689 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4690 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4691 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4692 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4693 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4694 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4695 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4696 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4697 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4698 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4699 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4700 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4701 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4702 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4703 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4704 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4705 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4706 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4707 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4708 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4709 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4710 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4711 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4712 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4713 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4714 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4715 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4716 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4717 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4718 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4719 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4720 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4721 dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4722 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4723 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4724 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4725 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4726 info->src += info->src_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4727 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4728 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4729 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4730 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
4731 static void SDL_Blit_RGBA8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4732 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4733 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4734 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4735 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4736 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4737 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4738 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4739 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4740 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4741 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4742 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4743 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4744 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4745 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4746 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4747 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4748 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4749 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4750 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4751 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4752 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4753 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4754 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4755 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4756 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4757 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4758 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4759 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4760 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4761 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4762 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4763 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4764 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4765 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4766 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4767 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4768 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4769 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4770 srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4771 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4772 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4773 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4774 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4775 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4776 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4777 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4778 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4779 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4780 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4781 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4782 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4783 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4784 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4785 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4786 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4787 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4788 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4789 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4790 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4791 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4792 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4793 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4794 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4795 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4796 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4797 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4798 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4799 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4800 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4801 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4802 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4803 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4804 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4805 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4806 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4807 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4808 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4809 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4810 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4811 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4812 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4813 dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4814 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4815 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4816 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4817 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4818 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4819 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4820 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4821 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4822 |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4823 static void SDL_Blit_RGBA8888_ARGB8888_Scale(SDL_BlitInfo *info) |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4824 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4825 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4826 Uint32 pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4827 Uint32 R, G, B, A; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4828 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4829 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4830 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4831 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4832 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4833 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4834 incy = (info->src_h << 16) / info->dst_h; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4835 incx = (info->src_w << 16) / info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4836 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4837 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4838 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4839 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4840 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4841 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4842 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4843 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4844 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4845 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4846 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4847 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4848 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4849 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4850 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4851 posx -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4852 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4853 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4854 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4855 pixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4856 R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4857 pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4858 *dst = pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4859 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4860 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4861 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4862 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4863 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4864 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4865 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4866 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4867 static void SDL_Blit_RGBA8888_ARGB8888_Blend(SDL_BlitInfo *info) |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4868 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4869 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4870 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4871 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4872 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4873 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4874 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4875 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4876 Uint32 *src = (Uint32 *)info->src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4877 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4878 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4879 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4880 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4881 srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4882 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4883 dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4884 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4885 /* This goes away if we ever use premultiplied alpha */ |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4886 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4887 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4888 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4889 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4890 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4891 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4892 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4893 case SDL_COPY_MASK: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4894 if (srcA) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4895 dstR = srcR; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4896 dstG = srcG; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4897 dstB = srcB; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4898 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4899 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4900 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4901 dstR = srcR + ((255 - srcA) * dstR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4902 dstG = srcG + ((255 - srcA) * dstG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4903 dstB = srcB + ((255 - srcA) * dstB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4904 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4905 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4906 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4907 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4908 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4909 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4910 case SDL_COPY_MOD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4911 dstR = (srcR * dstR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4912 dstG = (srcG * dstG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4913 dstB = (srcB * dstB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4914 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4915 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4916 dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4917 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4918 ++src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4919 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4920 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4921 info->src += info->src_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4922 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4923 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4924 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4925 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4926 static void SDL_Blit_RGBA8888_ARGB8888_Blend_Scale(SDL_BlitInfo *info) |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4927 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4928 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4929 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4930 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4931 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4932 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4933 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4934 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4935 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4936 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4937 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4938 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4939 incy = (info->src_h << 16) / info->dst_h; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4940 incx = (info->src_w << 16) / info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4941 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4942 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4943 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4944 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4945 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4946 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4947 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4948 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4949 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4950 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4951 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4952 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4953 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4954 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4955 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4956 posx -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4957 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4958 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4959 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4960 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4961 srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4962 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4963 dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4964 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4965 /* This goes away if we ever use premultiplied alpha */ |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4966 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4967 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4968 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4969 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4970 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4971 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4972 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4973 case SDL_COPY_MASK: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4974 if (srcA) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4975 dstR = srcR; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4976 dstG = srcG; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4977 dstB = srcB; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4978 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4979 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4980 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4981 dstR = srcR + ((255 - srcA) * dstR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4982 dstG = srcG + ((255 - srcA) * dstG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4983 dstB = srcB + ((255 - srcA) * dstB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4984 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4985 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4986 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4987 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4988 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4989 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4990 case SDL_COPY_MOD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4991 dstR = (srcR * dstR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4992 dstG = (srcG * dstG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4993 dstB = (srcB * dstB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4994 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4995 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4996 dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4997 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4998 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4999 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5000 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5001 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5002 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5003 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5004 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5005 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5006 static void SDL_Blit_RGBA8888_ARGB8888_Modulate(SDL_BlitInfo *info) |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5007 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5008 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5009 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5010 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5011 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5012 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5013 Uint32 pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5014 Uint32 R, G, B, A; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5015 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5016 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5017 Uint32 *src = (Uint32 *)info->src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5018 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5019 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5020 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5021 pixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5022 R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5023 if (flags & SDL_COPY_MODULATE_COLOR) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5024 R = (R * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5025 G = (G * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5026 B = (B * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5027 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5028 if (flags & SDL_COPY_MODULATE_ALPHA) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5029 A = (A * modulateA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5030 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5031 pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5032 *dst = pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5033 ++src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5034 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5035 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5036 info->src += info->src_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5037 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5038 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5039 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5040 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5041 static void SDL_Blit_RGBA8888_ARGB8888_Modulate_Scale(SDL_BlitInfo *info) |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5042 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5043 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5044 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5045 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5046 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5047 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5048 Uint32 pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5049 Uint32 R, G, B, A; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5050 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5051 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5052 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5053 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5054 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5055 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5056 incy = (info->src_h << 16) / info->dst_h; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5057 incx = (info->src_w << 16) / info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5058 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5059 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5060 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5061 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5062 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5063 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5064 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5065 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5066 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5067 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5068 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5069 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5070 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5071 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5072 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5073 posx -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5074 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5075 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5076 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5077 pixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5078 R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5079 if (flags & SDL_COPY_MODULATE_COLOR) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5080 R = (R * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5081 G = (G * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5082 B = (B * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5083 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5084 if (flags & SDL_COPY_MODULATE_ALPHA) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5085 A = (A * modulateA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5086 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5087 pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5088 *dst = pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5089 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5090 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5091 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5092 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5093 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5094 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5095 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5096 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5097 static void SDL_Blit_RGBA8888_ARGB8888_Modulate_Blend(SDL_BlitInfo *info) |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5098 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5099 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5100 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5101 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5102 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5103 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5104 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5105 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5106 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5107 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5108 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5109 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5110 Uint32 *src = (Uint32 *)info->src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5111 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5112 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5113 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5114 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5115 srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5116 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5117 dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5118 if (flags & SDL_COPY_MODULATE_COLOR) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5119 srcR = (srcR * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5120 srcG = (srcG * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5121 srcB = (srcB * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5122 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5123 if (flags & SDL_COPY_MODULATE_ALPHA) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5124 srcA = (srcA * modulateA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5125 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5126 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5127 /* This goes away if we ever use premultiplied alpha */ |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5128 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5129 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5130 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5131 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5132 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5133 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5134 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5135 case SDL_COPY_MASK: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5136 if (srcA) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5137 dstR = srcR; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5138 dstG = srcG; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5139 dstB = srcB; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5140 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5141 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5142 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5143 dstR = srcR + ((255 - srcA) * dstR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5144 dstG = srcG + ((255 - srcA) * dstG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5145 dstB = srcB + ((255 - srcA) * dstB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5146 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5147 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5148 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5149 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5150 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5151 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5152 case SDL_COPY_MOD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5153 dstR = (srcR * dstR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5154 dstG = (srcG * dstG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5155 dstB = (srcB * dstB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5156 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5157 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5158 dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5159 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5160 ++src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5161 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5162 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5163 info->src += info->src_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5164 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5165 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5166 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5167 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5168 static void SDL_Blit_RGBA8888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info) |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5169 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5170 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5171 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5172 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5173 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5174 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5175 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5176 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5177 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5178 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5179 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5180 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5181 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5182 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5183 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5184 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5185 incy = (info->src_h << 16) / info->dst_h; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5186 incx = (info->src_w << 16) / info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5187 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5188 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5189 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5190 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5191 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5192 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5193 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5194 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5195 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5196 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5197 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5198 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5199 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5200 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5201 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5202 posx -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5203 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5204 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5205 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5206 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5207 srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5208 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5209 dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5210 if (flags & SDL_COPY_MODULATE_COLOR) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5211 srcR = (srcR * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5212 srcG = (srcG * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5213 srcB = (srcB * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5214 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5215 if (flags & SDL_COPY_MODULATE_ALPHA) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5216 srcA = (srcA * modulateA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5217 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5218 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5219 /* This goes away if we ever use premultiplied alpha */ |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5220 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5221 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5222 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5223 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5224 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5225 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5226 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5227 case SDL_COPY_MASK: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5228 if (srcA) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5229 dstR = srcR; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5230 dstG = srcG; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5231 dstB = srcB; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5232 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5233 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5234 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5235 dstR = srcR + ((255 - srcA) * dstR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5236 dstG = srcG + ((255 - srcA) * dstG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5237 dstB = srcB + ((255 - srcA) * dstB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5238 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5239 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5240 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5241 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5242 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5243 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5244 case SDL_COPY_MOD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5245 dstR = (srcR * dstR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5246 dstG = (srcG * dstG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5247 dstB = (srcB * dstB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5248 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5249 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5250 dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5251 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5252 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5253 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5254 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5255 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5256 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5257 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5258 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5259 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5260 static void SDL_Blit_ABGR8888_RGB888_Scale(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5261 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5262 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5263 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5264 Uint32 R, G, B, A; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5265 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5266 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5267 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5268 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5269 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5270 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5271 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5272 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5273 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5274 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5275 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5276 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5277 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5278 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5279 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5280 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5281 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5282 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5283 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5284 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5285 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5286 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5287 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5288 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5289 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5290 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5291 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5292 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5293 A = (Uint8)(pixel >> 24); B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5294 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5295 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5296 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5297 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5298 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5299 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5300 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5301 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5302 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5303 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5304 static void SDL_Blit_ABGR8888_RGB888_Blend(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5305 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5306 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5307 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5308 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5309 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5310 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5311 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5312 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5313 Uint32 *src = (Uint32 *)info->src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5314 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5315 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5316 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5317 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5318 srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5319 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5320 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5321 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5322 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5323 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5324 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5325 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5326 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5327 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5328 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5329 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5330 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5331 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5332 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5333 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5334 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5335 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5336 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5337 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5338 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5339 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5340 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5341 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5342 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5343 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5344 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5345 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5346 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5347 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5348 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5349 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5350 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5351 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5352 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5353 dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5354 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5355 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5356 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5357 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5358 info->src += info->src_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5359 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5360 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5361 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5362 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5363 static void SDL_Blit_ABGR8888_RGB888_Blend_Scale(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5364 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5365 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5366 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5367 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5368 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5369 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5370 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5371 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5372 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5373 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5374 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5375 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5376 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5377 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5378 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5379 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5380 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5381 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5382 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5383 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5384 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5385 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5386 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5387 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5388 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5389 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5390 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5391 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5392 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5393 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5394 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5395 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5396 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5397 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5398 srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5399 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5400 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5401 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5402 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5403 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5404 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5405 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5406 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5407 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5408 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5409 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5410 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5411 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5412 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5413 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5414 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5415 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5416 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5417 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5418 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5419 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5420 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5421 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5422 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5423 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5424 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5425 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5426 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5427 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5428 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5429 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5430 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5431 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5432 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5433 dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5434 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5435 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5436 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5437 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5438 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5439 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5440 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5441 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5442 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5443 static void SDL_Blit_ABGR8888_RGB888_Modulate(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5444 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5445 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5446 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5447 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5448 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5449 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5450 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5451 Uint32 R, G, B, A; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5452 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5453 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5454 Uint32 *src = (Uint32 *)info->src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5455 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5456 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5457 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5458 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5459 A = (Uint8)(pixel >> 24); B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5460 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5461 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5462 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5463 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5464 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5465 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5466 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5467 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5468 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5469 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5470 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5471 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5472 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5473 info->src += info->src_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5474 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5475 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5476 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5477 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5478 static void SDL_Blit_ABGR8888_RGB888_Modulate_Scale(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5479 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5480 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5481 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5482 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5483 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5484 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5485 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5486 Uint32 R, G, B, A; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5487 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5488 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5489 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5490 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5491 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5492 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5493 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5494 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5495 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5496 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5497 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5498 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5499 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5500 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5501 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5502 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5503 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5504 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5505 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5506 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5507 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5508 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5509 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5510 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5511 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5512 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5513 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5514 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5515 A = (Uint8)(pixel >> 24); B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5516 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5517 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5518 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5519 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5520 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5521 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5522 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5523 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5524 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5525 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5526 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5527 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5528 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5529 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5530 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5531 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5532 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5533 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5534 static void SDL_Blit_ABGR8888_RGB888_Modulate_Blend(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5535 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5536 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5537 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5538 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5539 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5540 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5541 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5542 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5543 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5544 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5545 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5546 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5547 Uint32 *src = (Uint32 *)info->src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5548 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5549 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5550 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5551 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5552 srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5553 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5554 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5555 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5556 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5557 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5558 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5559 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5560 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5561 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5562 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5563 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5564 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5565 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5566 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5567 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5568 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5569 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5570 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5571 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5572 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5573 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5574 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5575 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5576 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5577 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5578 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5579 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5580 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5581 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5582 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5583 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5584 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5585 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5586 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5587 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5588 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5589 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5590 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5591 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5592 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5593 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5594 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5595 dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5596 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5597 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5598 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5599 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5600 info->src += info->src_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5601 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5602 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5603 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5604 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5605 static void SDL_Blit_ABGR8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5606 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5607 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5608 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5609 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5610 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5611 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5612 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5613 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5614 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5615 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5616 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5617 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5618 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5619 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5620 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5621 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5622 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5623 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5624 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5625 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5626 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5627 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5628 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5629 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5630 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5631 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5632 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5633 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5634 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5635 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5636 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5637 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5638 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5639 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5640 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5641 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5642 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5643 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5644 srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5645 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5646 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5647 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5648 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5649 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5650 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5651 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5652 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5653 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5654 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5655 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5656 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5657 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5658 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5659 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5660 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5661 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5662 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5663 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5664 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5665 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5666 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5667 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5668 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5669 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5670 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5671 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5672 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5673 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5674 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5675 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5676 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5677 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5678 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5679 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5680 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5681 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5682 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5683 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5684 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5685 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5686 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5687 dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5688 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5689 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5690 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5691 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5692 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5693 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5694 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5695 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5696 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5697 static void SDL_Blit_ABGR8888_BGR888_Scale(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5698 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5699 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5700 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5701 Uint32 R, G, B, A; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5702 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5703 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5704 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5705 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5706 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5707 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5708 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5709 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5710 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5711 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5712 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5713 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5714 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5715 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5716 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5717 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5718 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5719 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5720 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5721 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5722 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5723 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5724 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5725 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5726 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5727 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5728 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5729 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5730 A = (Uint8)(pixel >> 24); B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5731 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5732 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5733 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5734 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5735 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5736 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5737 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5738 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5739 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5740 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5741 static void SDL_Blit_ABGR8888_BGR888_Blend(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5742 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5743 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5744 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5745 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5746 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5747 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5748 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5749 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5750 Uint32 *src = (Uint32 *)info->src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5751 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5752 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5753 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5754 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5755 srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5756 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5757 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5758 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5759 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5760 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5761 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5762 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5763 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5764 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5765 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5766 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5767 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5768 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5769 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5770 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5771 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5772 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5773 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5774 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5775 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5776 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5777 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5778 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5779 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5780 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5781 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5782 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5783 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5784 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5785 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5786 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5787 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5788 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5789 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5790 dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5791 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5792 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5793 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5794 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5795 info->src += info->src_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5796 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5797 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5798 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5799 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5800 static void SDL_Blit_ABGR8888_BGR888_Blend_Scale(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5801 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5802 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5803 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5804 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5805 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5806 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5807 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5808 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5809 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5810 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5811 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5812 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5813 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5814 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5815 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5816 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5817 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5818 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5819 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5820 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5821 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5822 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5823 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5824 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5825 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5826 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5827 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5828 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5829 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5830 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5831 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5832 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5833 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5834 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5835 srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5836 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5837 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5838 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5839 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5840 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5841 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5842 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5843 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5844 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5845 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5846 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5847 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5848 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5849 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5850 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5851 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5852 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5853 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5854 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5855 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5856 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5857 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5858 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5859 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5860 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5861 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5862 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5863 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5864 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5865 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5866 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5867 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5868 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5869 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5870 dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5871 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5872 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5873 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5874 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5875 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5876 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5877 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5878 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5879 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5880 static void SDL_Blit_ABGR8888_BGR888_Modulate(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5881 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5882 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5883 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5884 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5885 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5886 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5887 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5888 Uint32 R, G, B, A; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5889 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5890 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5891 Uint32 *src = (Uint32 *)info->src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5892 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5893 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5894 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5895 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5896 A = (Uint8)(pixel >> 24); B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5897 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5898 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5899 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5900 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5901 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5902 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5903 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5904 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5905 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5906 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5907 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5908 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5909 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5910 info->src += info->src_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5911 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5912 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5913 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5914 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5915 static void SDL_Blit_ABGR8888_BGR888_Modulate_Scale(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5916 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5917 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5918 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5919 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5920 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5921 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5922 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5923 Uint32 R, G, B, A; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5924 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5925 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5926 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5927 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5928 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5929 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5930 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5931 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5932 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5933 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5934 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5935 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5936 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5937 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5938 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5939 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5940 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5941 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5942 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5943 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5944 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5945 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5946 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5947 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5948 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5949 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5950 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5951 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5952 A = (Uint8)(pixel >> 24); B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5953 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5954 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5955 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5956 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5957 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5958 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5959 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5960 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5961 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5962 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5963 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5964 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5965 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5966 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5967 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5968 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5969 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5970 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5971 static void SDL_Blit_ABGR8888_BGR888_Modulate_Blend(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5972 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5973 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5974 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5975 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5976 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5977 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5978 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5979 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5980 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5981 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5982 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5983 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5984 Uint32 *src = (Uint32 *)info->src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5985 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5986 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5987 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5988 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5989 srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5990 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5991 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5992 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5993 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5994 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5995 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5996 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5997 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5998 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5999 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6000 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6001 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6002 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6003 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6004 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6005 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6006 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6007 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6008 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6009 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6010 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6011 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6012 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6013 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6014 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6015 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6016 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6017 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6018 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6019 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6020 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6021 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6022 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6023 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6024 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6025 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6026 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6027 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6028 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6029 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6030 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6031 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6032 dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6033 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6034 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6035 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6036 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6037 info->src += info->src_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6038 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6039 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6040 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6041 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
6042 static void SDL_Blit_ABGR8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6043 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6044 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6045 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6046 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6047 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6048 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6049 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6050 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6051 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6052 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6053 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6054 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6055 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6056 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6057 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6058 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6059 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6060 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6061 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6062 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6063 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6064 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6065 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6066 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6067 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6068 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6069 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6070 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6071 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6072 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6073 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6074 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6075 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6076 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6077 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6078 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6079 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6080 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6081 srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6082 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6083 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6084 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6085 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6086 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6087 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6088 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6089 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6090 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6091 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6092 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6093 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6094 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6095 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6096 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6097 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6098 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6099 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6100 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6101 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6102 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6103 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6104 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6105 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6106 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6107 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6108 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6109 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6110 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6111 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6112 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6113 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6114 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6115 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6116 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6117 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6118 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6119 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6120 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6121 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6122 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6123 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6124 dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6125 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6126 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6127 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6128 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6129 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6130 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6131 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6132 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6133 |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6134 static void SDL_Blit_ABGR8888_ARGB8888_Scale(SDL_BlitInfo *info) |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6135 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6136 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6137 Uint32 pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6138 Uint32 R, G, B, A; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6139 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6140 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6141 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6142 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6143 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6144 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6145 incy = (info->src_h << 16) / info->dst_h; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6146 incx = (info->src_w << 16) / info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6147 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6148 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6149 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6150 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6151 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6152 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6153 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6154 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6155 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6156 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6157 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6158 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6159 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6160 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6161 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6162 posx -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6163 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6164 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6165 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6166 pixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6167 A = (Uint8)(pixel >> 24); B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6168 pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6169 *dst = pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6170 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6171 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6172 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6173 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6174 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6175 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6176 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6177 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6178 static void SDL_Blit_ABGR8888_ARGB8888_Blend(SDL_BlitInfo *info) |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6179 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6180 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6181 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6182 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6183 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6184 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6185 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6186 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6187 Uint32 *src = (Uint32 *)info->src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6188 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6189 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6190 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6191 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6192 srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6193 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6194 dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6195 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6196 /* This goes away if we ever use premultiplied alpha */ |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6197 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6198 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6199 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6200 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6201 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6202 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6203 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6204 case SDL_COPY_MASK: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6205 if (srcA) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6206 dstR = srcR; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6207 dstG = srcG; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6208 dstB = srcB; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6209 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6210 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6211 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6212 dstR = srcR + ((255 - srcA) * dstR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6213 dstG = srcG + ((255 - srcA) * dstG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6214 dstB = srcB + ((255 - srcA) * dstB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6215 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6216 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6217 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6218 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6219 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6220 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6221 case SDL_COPY_MOD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6222 dstR = (srcR * dstR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6223 dstG = (srcG * dstG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6224 dstB = (srcB * dstB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6225 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6226 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6227 dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6228 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6229 ++src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6230 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6231 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6232 info->src += info->src_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6233 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6234 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6235 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6236 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6237 static void SDL_Blit_ABGR8888_ARGB8888_Blend_Scale(SDL_BlitInfo *info) |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6238 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6239 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6240 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6241 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6242 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6243 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6244 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6245 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6246 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6247 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6248 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6249 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6250 incy = (info->src_h << 16) / info->dst_h; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6251 incx = (info->src_w << 16) / info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6252 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6253 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6254 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6255 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6256 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6257 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6258 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6259 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6260 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6261 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6262 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6263 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6264 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6265 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6266 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6267 posx -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6268 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6269 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6270 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6271 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6272 srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6273 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6274 dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6275 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6276 /* This goes away if we ever use premultiplied alpha */ |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6277 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6278 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6279 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6280 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6281 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6282 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6283 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6284 case SDL_COPY_MASK: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6285 if (srcA) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6286 dstR = srcR; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6287 dstG = srcG; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6288 dstB = srcB; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6289 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6290 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6291 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6292 dstR = srcR + ((255 - srcA) * dstR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6293 dstG = srcG + ((255 - srcA) * dstG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6294 dstB = srcB + ((255 - srcA) * dstB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6295 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6296 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6297 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6298 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6299 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6300 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6301 case SDL_COPY_MOD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6302 dstR = (srcR * dstR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6303 dstG = (srcG * dstG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6304 dstB = (srcB * dstB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6305 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6306 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6307 dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6308 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6309 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6310 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6311 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6312 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6313 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6314 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6315 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6316 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6317 static void SDL_Blit_ABGR8888_ARGB8888_Modulate(SDL_BlitInfo *info) |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6318 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6319 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6320 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6321 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6322 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6323 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6324 Uint32 pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6325 Uint32 R, G, B, A; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6326 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6327 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6328 Uint32 *src = (Uint32 *)info->src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6329 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6330 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6331 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6332 pixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6333 A = (Uint8)(pixel >> 24); B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6334 if (flags & SDL_COPY_MODULATE_COLOR) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6335 R = (R * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6336 G = (G * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6337 B = (B * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6338 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6339 if (flags & SDL_COPY_MODULATE_ALPHA) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6340 A = (A * modulateA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6341 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6342 pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6343 *dst = pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6344 ++src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6345 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6346 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6347 info->src += info->src_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6348 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6349 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6350 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6351 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6352 static void SDL_Blit_ABGR8888_ARGB8888_Modulate_Scale(SDL_BlitInfo *info) |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6353 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6354 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6355 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6356 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6357 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6358 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6359 Uint32 pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6360 Uint32 R, G, B, A; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6361 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6362 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6363 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6364 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6365 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6366 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6367 incy = (info->src_h << 16) / info->dst_h; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6368 incx = (info->src_w << 16) / info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6369 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6370 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6371 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6372 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6373 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6374 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6375 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6376 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6377 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6378 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6379 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6380 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6381 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6382 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6383 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6384 posx -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6385 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6386 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6387 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6388 pixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6389 A = (Uint8)(pixel >> 24); B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6390 if (flags & SDL_COPY_MODULATE_COLOR) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6391 R = (R * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6392 G = (G * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6393 B = (B * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6394 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6395 if (flags & SDL_COPY_MODULATE_ALPHA) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6396 A = (A * modulateA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6397 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6398 pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6399 *dst = pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6400 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6401 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6402 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6403 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6404 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6405 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6406 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6407 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6408 static void SDL_Blit_ABGR8888_ARGB8888_Modulate_Blend(SDL_BlitInfo *info) |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6409 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6410 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6411 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6412 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6413 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6414 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6415 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6416 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6417 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6418 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6419 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6420 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6421 Uint32 *src = (Uint32 *)info->src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6422 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6423 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6424 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6425 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6426 srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6427 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6428 dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6429 if (flags & SDL_COPY_MODULATE_COLOR) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6430 srcR = (srcR * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6431 srcG = (srcG * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6432 srcB = (srcB * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6433 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6434 if (flags & SDL_COPY_MODULATE_ALPHA) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6435 srcA = (srcA * modulateA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6436 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6437 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6438 /* This goes away if we ever use premultiplied alpha */ |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6439 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6440 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6441 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6442 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6443 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6444 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6445 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6446 case SDL_COPY_MASK: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6447 if (srcA) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6448 dstR = srcR; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6449 dstG = srcG; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6450 dstB = srcB; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6451 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6452 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6453 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6454 dstR = srcR + ((255 - srcA) * dstR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6455 dstG = srcG + ((255 - srcA) * dstG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6456 dstB = srcB + ((255 - srcA) * dstB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6457 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6458 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6459 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6460 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6461 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6462 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6463 case SDL_COPY_MOD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6464 dstR = (srcR * dstR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6465 dstG = (srcG * dstG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6466 dstB = (srcB * dstB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6467 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6468 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6469 dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6470 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6471 ++src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6472 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6473 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6474 info->src += info->src_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6475 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6476 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6477 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6478 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6479 static void SDL_Blit_ABGR8888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info) |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6480 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6481 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6482 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6483 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6484 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6485 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6486 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6487 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6488 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6489 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6490 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6491 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6492 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6493 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6494 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6495 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6496 incy = (info->src_h << 16) / info->dst_h; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6497 incx = (info->src_w << 16) / info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6498 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6499 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6500 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6501 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6502 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6503 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6504 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6505 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6506 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6507 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6508 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6509 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6510 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6511 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6512 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6513 posx -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6514 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6515 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6516 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6517 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6518 srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6519 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6520 dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6521 if (flags & SDL_COPY_MODULATE_COLOR) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6522 srcR = (srcR * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6523 srcG = (srcG * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6524 srcB = (srcB * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6525 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6526 if (flags & SDL_COPY_MODULATE_ALPHA) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6527 srcA = (srcA * modulateA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6528 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6529 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6530 /* This goes away if we ever use premultiplied alpha */ |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6531 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6532 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6533 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6534 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6535 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6536 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6537 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6538 case SDL_COPY_MASK: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6539 if (srcA) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6540 dstR = srcR; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6541 dstG = srcG; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6542 dstB = srcB; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6543 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6544 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6545 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6546 dstR = srcR + ((255 - srcA) * dstR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6547 dstG = srcG + ((255 - srcA) * dstG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6548 dstB = srcB + ((255 - srcA) * dstB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6549 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6550 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6551 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6552 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6553 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6554 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6555 case SDL_COPY_MOD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6556 dstR = (srcR * dstR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6557 dstG = (srcG * dstG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6558 dstB = (srcB * dstB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6559 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6560 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6561 dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6562 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6563 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6564 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6565 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6566 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6567 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6568 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6569 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6570 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
6571 static void SDL_Blit_BGRA8888_RGB888_Scale(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6572 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6573 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6574 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6575 Uint32 R, G, B, A; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6576 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6577 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6578 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6579 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6580 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6581 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6582 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6583 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6584 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6585 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6586 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6587 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6588 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6589 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6590 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6591 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6592 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6593 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6594 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6595 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6596 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6597 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6598 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6599 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6600 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6601 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6602 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6603 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6604 B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); A = (Uint8)pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6605 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6606 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6607 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6608 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6609 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6610 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6611 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6612 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6613 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6614 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
6615 static void SDL_Blit_BGRA8888_RGB888_Blend(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6616 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6617 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6618 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6619 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6620 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6621 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6622 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6623 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6624 Uint32 *src = (Uint32 *)info->src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6625 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6626 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6627 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6628 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6629 srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6630 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6631 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6632 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6633 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6634 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6635 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6636 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6637 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6638 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6639 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6640 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6641 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6642 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6643 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6644 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6645 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6646 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6647 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6648 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6649 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6650 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6651 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6652 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6653 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6654 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6655 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6656 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6657 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6658 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6659 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6660 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6661 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6662 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6663 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6664 dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6665 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6666 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6667 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6668 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6669 info->src += info->src_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6670 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6671 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6672 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6673 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
6674 static void SDL_Blit_BGRA8888_RGB888_Blend_Scale(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6675 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6676 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6677 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6678 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6679 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6680 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6681 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6682 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6683 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6684 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6685 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6686 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6687 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6688 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6689 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6690 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6691 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6692 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6693 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6694 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6695 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6696 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6697 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6698 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6699 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6700 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6701 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6702 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6703 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6704 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6705 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6706 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6707 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6708 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6709 srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6710 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6711 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6712 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6713 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6714 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6715 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6716 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6717 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6718 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6719 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6720 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6721 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6722 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6723 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6724 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6725 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6726 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6727 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6728 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6729 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6730 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6731 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6732 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6733 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6734 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6735 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6736 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6737 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6738 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6739 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6740 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6741 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6742 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6743 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6744 dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6745 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6746 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6747 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6748 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6749 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6750 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6751 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6752 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6753 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
6754 static void SDL_Blit_BGRA8888_RGB888_Modulate(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6755 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6756 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6757 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6758 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6759 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6760 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6761 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6762 Uint32 R, G, B, A; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6763 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6764 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6765 Uint32 *src = (Uint32 *)info->src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6766 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6767 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6768 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6769 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6770 B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); A = (Uint8)pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6771 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6772 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6773 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6774 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6775 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6776 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6777 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6778 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6779 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6780 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6781 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6782 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6783 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6784 info->src += info->src_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6785 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6786 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6787 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6788 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
6789 static void SDL_Blit_BGRA8888_RGB888_Modulate_Scale(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6790 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6791 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6792 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6793 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6794 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6795 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6796 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6797 Uint32 R, G, B, A; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6798 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6799 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6800 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6801 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6802 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6803 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6804 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6805 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6806 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6807 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6808 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6809 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6810 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6811 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6812 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6813 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6814 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6815 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6816 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6817 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6818 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6819 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6820 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6821 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6822 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6823 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6824 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6825 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6826 B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); A = (Uint8)pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6827 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6828 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6829 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6830 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6831 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6832 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6833 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6834 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6835 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6836 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6837 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6838 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6839 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6840 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6841 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6842 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6843 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6844 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
6845 static void SDL_Blit_BGRA8888_RGB888_Modulate_Blend(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6846 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6847 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6848 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6849 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6850 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6851 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6852 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6853 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6854 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6855 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6856 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6857 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6858 Uint32 *src = (Uint32 *)info->src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6859 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6860 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6861 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6862 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6863 srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6864 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6865 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6866 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6867 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6868 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6869 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6870 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6871 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6872 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6873 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6874 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6875 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6876 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6877 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6878 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6879 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6880 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6881 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6882 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6883 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6884 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6885 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6886 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6887 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6888 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6889 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6890 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6891 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6892 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6893 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6894 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6895 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6896 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6897 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6898 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6899 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6900 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6901 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6902 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6903 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6904 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6905 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6906 dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6907 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6908 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6909 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6910 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6911 info->src += info->src_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6912 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6913 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6914 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6915 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
6916 static void SDL_Blit_BGRA8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6917 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6918 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6919 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6920 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6921 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6922 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6923 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6924 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6925 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6926 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6927 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6928 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6929 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6930 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6931 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6932 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6933 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6934 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6935 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6936 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6937 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6938 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6939 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6940 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6941 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6942 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6943 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6944 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6945 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6946 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6947 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6948 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6949 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6950 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6951 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6952 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6953 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6954 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6955 srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6956 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6957 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6958 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6959 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6960 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6961 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6962 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6963 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6964 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6965 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6966 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6967 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6968 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6969 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6970 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6971 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6972 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6973 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6974 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6975 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6976 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6977 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6978 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6979 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6980 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6981 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6982 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6983 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6984 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6985 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6986 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6987 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6988 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6989 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6990 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6991 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6992 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6993 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6994 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6995 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6996 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6997 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6998 dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6999 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7000 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7001 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7002 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7003 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7004 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7005 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7006 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7007 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7008 static void SDL_Blit_BGRA8888_BGR888_Scale(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7009 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7010 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7011 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7012 Uint32 R, G, B, A; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7013 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7014 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7015 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7016 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7017 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7018 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7019 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7020 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7021 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7022 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7023 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7024 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7025 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7026 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7027 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7028 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7029 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7030 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7031 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7032 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7033 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7034 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7035 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7036 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7037 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7038 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7039 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7040 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7041 B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); A = (Uint8)pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7042 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7043 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7044 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7045 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7046 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7047 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7048 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7049 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7050 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7051 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7052 static void SDL_Blit_BGRA8888_BGR888_Blend(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7053 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7054 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7055 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7056 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7057 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7058 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7059 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7060 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7061 Uint32 *src = (Uint32 *)info->src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7062 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7063 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7064 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7065 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7066 srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7067 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7068 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7069 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7070 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7071 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7072 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7073 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7074 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7075 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7076 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7077 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7078 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7079 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7080 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7081 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7082 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7083 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7084 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7085 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7086 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7087 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7088 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7089 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7090 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7091 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7092 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7093 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7094 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7095 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7096 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7097 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7098 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7099 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7100 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7101 dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7102 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7103 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7104 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7105 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7106 info->src += info->src_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7107 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7108 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7109 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7110 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7111 static void SDL_Blit_BGRA8888_BGR888_Blend_Scale(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7112 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7113 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7114 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7115 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7116 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7117 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7118 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7119 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7120 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7121 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7122 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7123 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7124 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7125 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7126 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7127 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7128 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7129 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7130 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7131 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7132 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7133 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7134 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7135 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7136 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7137 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7138 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7139 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7140 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7141 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7142 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7143 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7144 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7145 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7146 srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7147 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7148 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7149 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7150 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7151 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7152 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7153 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7154 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7155 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7156 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7157 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7158 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7159 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7160 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7161 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7162 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7163 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7164 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7165 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7166 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7167 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7168 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7169 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7170 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7171 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7172 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7173 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7174 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7175 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7176 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7177 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7178 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7179 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7180 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7181 dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7182 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7183 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7184 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7185 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7186 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7187 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7188 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7189 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7190 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7191 static void SDL_Blit_BGRA8888_BGR888_Modulate(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7192 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7193 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7194 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7195 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7196 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7197 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7198 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7199 Uint32 R, G, B, A; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7200 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7201 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7202 Uint32 *src = (Uint32 *)info->src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7203 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7204 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7205 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7206 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7207 B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); A = (Uint8)pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7208 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7209 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7210 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7211 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7212 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7213 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7214 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7215 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7216 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7217 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7218 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7219 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7220 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7221 info->src += info->src_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7222 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7223 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7224 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7225 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7226 static void SDL_Blit_BGRA8888_BGR888_Modulate_Scale(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7227 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7228 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7229 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7230 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7231 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7232 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7233 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7234 Uint32 R, G, B, A; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7235 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7236 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7237 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7238 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7239 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7240 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7241 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7242 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7243 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7244 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7245 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7246 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7247 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7248 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7249 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7250 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7251 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7252 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7253 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7254 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7255 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7256 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7257 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7258 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7259 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7260 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7261 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7262 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7263 B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); A = (Uint8)pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7264 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7265 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7266 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7267 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7268 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7269 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7270 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7271 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7272 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7273 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7274 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7275 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7276 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7277 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7278 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7279 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7280 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7281 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7282 static void SDL_Blit_BGRA8888_BGR888_Modulate_Blend(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7283 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7284 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7285 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7286 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7287 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7288 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7289 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7290 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7291 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7292 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7293 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7294 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7295 Uint32 *src = (Uint32 *)info->src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7296 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7297 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7298 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7299 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7300 srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7301 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7302 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7303 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7304 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7305 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7306 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7307 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7308 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7309 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7310 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7311 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7312 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7313 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7314 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7315 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7316 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7317 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7318 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7319 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7320 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7321 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7322 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7323 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7324 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7325 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7326 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7327 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7328 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7329 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7330 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7331 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7332 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7333 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7334 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7335 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7336 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7337 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7338 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7339 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7340 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7341 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7342 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7343 dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7344 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7345 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7346 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7347 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7348 info->src += info->src_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7349 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7350 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7351 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7352 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7353 static void SDL_Blit_BGRA8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7354 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7355 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7356 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7357 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7358 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7359 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7360 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7361 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7362 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7363 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7364 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7365 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7366 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7367 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7368 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7369 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7370 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7371 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7372 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7373 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7374 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7375 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7376 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7377 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7378 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7379 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7380 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7381 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7382 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7383 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7384 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7385 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7386 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7387 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7388 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7389 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7390 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7391 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7392 srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7393 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7394 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7395 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7396 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7397 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7398 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7399 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7400 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7401 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7402 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7403 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7404 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7405 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7406 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7407 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7408 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7409 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7410 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7411 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7412 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7413 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7414 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7415 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7416 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7417 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7418 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7419 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7420 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7421 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7422 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7423 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7424 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7425 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7426 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7427 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7428 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7429 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7430 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7431 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7432 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7433 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7434 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7435 dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7436 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7437 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7438 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7439 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7440 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7441 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7442 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7443 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7444 |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7445 static void SDL_Blit_BGRA8888_ARGB8888_Scale(SDL_BlitInfo *info) |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7446 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7447 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7448 Uint32 pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7449 Uint32 R, G, B, A; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7450 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7451 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7452 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7453 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7454 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7455 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7456 incy = (info->src_h << 16) / info->dst_h; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7457 incx = (info->src_w << 16) / info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7458 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7459 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7460 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7461 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7462 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7463 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7464 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7465 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7466 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7467 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7468 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7469 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7470 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7471 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7472 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7473 posx -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7474 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7475 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7476 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7477 pixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7478 B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); A = (Uint8)pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7479 pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7480 *dst = pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7481 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7482 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7483 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7484 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7485 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7486 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7487 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7488 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7489 static void SDL_Blit_BGRA8888_ARGB8888_Blend(SDL_BlitInfo *info) |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7490 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7491 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7492 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7493 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7494 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7495 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7496 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7497 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7498 Uint32 *src = (Uint32 *)info->src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7499 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7500 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7501 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7502 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7503 srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7504 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7505 dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7506 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7507 /* This goes away if we ever use premultiplied alpha */ |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7508 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7509 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7510 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7511 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7512 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7513 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7514 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7515 case SDL_COPY_MASK: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7516 if (srcA) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7517 dstR = srcR; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7518 dstG = srcG; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7519 dstB = srcB; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7520 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7521 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7522 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7523 dstR = srcR + ((255 - srcA) * dstR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7524 dstG = srcG + ((255 - srcA) * dstG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7525 dstB = srcB + ((255 - srcA) * dstB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7526 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7527 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7528 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7529 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7530 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7531 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7532 case SDL_COPY_MOD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7533 dstR = (srcR * dstR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7534 dstG = (srcG * dstG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7535 dstB = (srcB * dstB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7536 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7537 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7538 dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7539 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7540 ++src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7541 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7542 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7543 info->src += info->src_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7544 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7545 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7546 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7547 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7548 static void SDL_Blit_BGRA8888_ARGB8888_Blend_Scale(SDL_BlitInfo *info) |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7549 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7550 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7551 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7552 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7553 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7554 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7555 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7556 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7557 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7558 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7559 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7560 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7561 incy = (info->src_h << 16) / info->dst_h; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7562 incx = (info->src_w << 16) / info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7563 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7564 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7565 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7566 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7567 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7568 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7569 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7570 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7571 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7572 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7573 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7574 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7575 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7576 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7577 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7578 posx -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7579 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7580 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7581 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7582 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7583 srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7584 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7585 dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7586 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7587 /* This goes away if we ever use premultiplied alpha */ |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7588 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7589 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7590 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7591 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7592 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7593 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7594 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7595 case SDL_COPY_MASK: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7596 if (srcA) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7597 dstR = srcR; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7598 dstG = srcG; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7599 dstB = srcB; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7600 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7601 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7602 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7603 dstR = srcR + ((255 - srcA) * dstR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7604 dstG = srcG + ((255 - srcA) * dstG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7605 dstB = srcB + ((255 - srcA) * dstB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7606 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7607 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7608 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7609 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7610 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7611 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7612 case SDL_COPY_MOD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7613 dstR = (srcR * dstR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7614 dstG = (srcG * dstG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7615 dstB = (srcB * dstB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7616 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7617 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7618 dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7619 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7620 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7621 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7622 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7623 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7624 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7625 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7626 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7627 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7628 static void SDL_Blit_BGRA8888_ARGB8888_Modulate(SDL_BlitInfo *info) |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7629 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7630 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7631 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7632 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7633 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7634 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7635 Uint32 pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7636 Uint32 R, G, B, A; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7637 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7638 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7639 Uint32 *src = (Uint32 *)info->src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7640 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7641 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7642 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7643 pixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7644 B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); A = (Uint8)pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7645 if (flags & SDL_COPY_MODULATE_COLOR) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7646 R = (R * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7647 G = (G * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7648 B = (B * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7649 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7650 if (flags & SDL_COPY_MODULATE_ALPHA) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7651 A = (A * modulateA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7652 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7653 pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7654 *dst = pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7655 ++src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7656 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7657 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7658 info->src += info->src_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7659 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7660 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7661 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7662 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7663 static void SDL_Blit_BGRA8888_ARGB8888_Modulate_Scale(SDL_BlitInfo *info) |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7664 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7665 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7666 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7667 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7668 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7669 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7670 Uint32 pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7671 Uint32 R, G, B, A; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7672 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7673 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7674 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7675 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7676 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7677 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7678 incy = (info->src_h << 16) / info->dst_h; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7679 incx = (info->src_w << 16) / info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7680 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7681 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7682 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7683 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7684 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7685 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7686 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7687 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7688 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7689 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7690 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7691 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7692 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7693 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7694 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7695 posx -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7696 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7697 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7698 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7699 pixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7700 B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); A = (Uint8)pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7701 if (flags & SDL_COPY_MODULATE_COLOR) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7702 R = (R * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7703 G = (G * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7704 B = (B * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7705 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7706 if (flags & SDL_COPY_MODULATE_ALPHA) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7707 A = (A * modulateA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7708 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7709 pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7710 *dst = pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7711 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7712 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7713 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7714 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7715 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7716 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7717 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7718 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7719 static void SDL_Blit_BGRA8888_ARGB8888_Modulate_Blend(SDL_BlitInfo *info) |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7720 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7721 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7722 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7723 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7724 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7725 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7726 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7727 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7728 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7729 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7730 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7731 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7732 Uint32 *src = (Uint32 *)info->src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7733 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7734 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7735 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7736 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7737 srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7738 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7739 dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7740 if (flags & SDL_COPY_MODULATE_COLOR) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7741 srcR = (srcR * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7742 srcG = (srcG * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7743 srcB = (srcB * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7744 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7745 if (flags & SDL_COPY_MODULATE_ALPHA) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7746 srcA = (srcA * modulateA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7747 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7748 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7749 /* This goes away if we ever use premultiplied alpha */ |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7750 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7751 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7752 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7753 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7754 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7755 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7756 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7757 case SDL_COPY_MASK: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7758 if (srcA) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7759 dstR = srcR; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7760 dstG = srcG; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7761 dstB = srcB; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7762 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7763 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7764 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7765 dstR = srcR + ((255 - srcA) * dstR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7766 dstG = srcG + ((255 - srcA) * dstG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7767 dstB = srcB + ((255 - srcA) * dstB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7768 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7769 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7770 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7771 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7772 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7773 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7774 case SDL_COPY_MOD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7775 dstR = (srcR * dstR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7776 dstG = (srcG * dstG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7777 dstB = (srcB * dstB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7778 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7779 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7780 dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7781 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7782 ++src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7783 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7784 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7785 info->src += info->src_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7786 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7787 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7788 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7789 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7790 static void SDL_Blit_BGRA8888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info) |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7791 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7792 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7793 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7794 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7795 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7796 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7797 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7798 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7799 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7800 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7801 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7802 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7803 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7804 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7805 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7806 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7807 incy = (info->src_h << 16) / info->dst_h; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7808 incx = (info->src_w << 16) / info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7809 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7810 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7811 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7812 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7813 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7814 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7815 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7816 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7817 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7818 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7819 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7820 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7821 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7822 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7823 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7824 posx -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7825 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7826 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7827 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7828 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7829 srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7830 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7831 dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7832 if (flags & SDL_COPY_MODULATE_COLOR) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7833 srcR = (srcR * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7834 srcG = (srcG * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7835 srcB = (srcB * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7836 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7837 if (flags & SDL_COPY_MODULATE_ALPHA) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7838 srcA = (srcA * modulateA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7839 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7840 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7841 /* This goes away if we ever use premultiplied alpha */ |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7842 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7843 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7844 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7845 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7846 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7847 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7848 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7849 case SDL_COPY_MASK: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7850 if (srcA) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7851 dstR = srcR; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7852 dstG = srcG; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7853 dstB = srcB; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7854 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7855 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7856 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7857 dstR = srcR + ((255 - srcA) * dstR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7858 dstG = srcG + ((255 - srcA) * dstG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7859 dstB = srcB + ((255 - srcA) * dstB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7860 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7861 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7862 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7863 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7864 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7865 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7866 case SDL_COPY_MOD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7867 dstR = (srcR * dstR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7868 dstG = (srcG * dstG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7869 dstB = (srcB * dstB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7870 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7871 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7872 dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7873 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7874 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7875 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7876 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7877 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7878 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7879 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7880 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7881 |
2267
c785543d1843
Okay, still some bugs, but everything builds again...
Sam Lantinga <slouken@libsdl.org>
parents:
2263
diff
changeset
|
7882 SDL_BlitFuncEntry SDL_GeneratedBlitFuncTable[] = { |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7883 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_RGB888_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7884 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGB888_RGB888_Blend }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7885 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_RGB888_Blend_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7886 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_RGB888_RGB888_Modulate }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7887 { 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 }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7888 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGB888_RGB888_Modulate_Blend }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7889 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_RGB888_Modulate_Blend_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7890 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_BGR888_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7891 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGB888_BGR888_Blend }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7892 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_BGR888_Blend_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7893 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_RGB888_BGR888_Modulate }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7894 { 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 }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7895 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGB888_BGR888_Modulate_Blend }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7896 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_BGR888_Modulate_Blend_Scale }, |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7897 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_ARGB8888_Scale }, |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7898 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGB888_ARGB8888_Blend }, |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7899 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_ARGB8888_Blend_Scale }, |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7900 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_RGB888_ARGB8888_Modulate }, |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7901 { 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 }, |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7902 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGB888_ARGB8888_Modulate_Blend }, |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7903 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_ARGB8888_Modulate_Blend_Scale }, |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7904 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7905 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Blend }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7906 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Blend_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7907 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Modulate }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7908 { 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 }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7909 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Modulate_Blend }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7910 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Modulate_Blend_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7911 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_BGR888_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7912 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGR888_BGR888_Blend }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7913 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_BGR888_Blend_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7914 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_BGR888_BGR888_Modulate }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7915 { 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 }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7916 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGR888_BGR888_Modulate_Blend }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7917 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_BGR888_Modulate_Blend_Scale }, |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7918 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_ARGB8888_Scale }, |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7919 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGR888_ARGB8888_Blend }, |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7920 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_ARGB8888_Blend_Scale }, |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7921 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_BGR888_ARGB8888_Modulate }, |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7922 { 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 }, |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7923 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGR888_ARGB8888_Modulate_Blend }, |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7924 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_ARGB8888_Modulate_Blend_Scale }, |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7925 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7926 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Blend }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7927 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Blend_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7928 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Modulate }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7929 { 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 }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7930 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Modulate_Blend }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7931 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Modulate_Blend_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7932 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_BGR888_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7933 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ARGB8888_BGR888_Blend }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7934 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_BGR888_Blend_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7935 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_ARGB8888_BGR888_Modulate }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7936 { 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 }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7937 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ARGB8888_BGR888_Modulate_Blend }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7938 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_BGR888_Modulate_Blend_Scale }, |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7939 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_ARGB8888_Scale }, |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7940 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ARGB8888_ARGB8888_Blend }, |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7941 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_ARGB8888_Blend_Scale }, |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7942 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_ARGB8888_ARGB8888_Modulate }, |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7943 { 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 }, |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7944 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ARGB8888_ARGB8888_Modulate_Blend }, |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7945 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_ARGB8888_Modulate_Blend_Scale }, |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7946 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7947 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Blend }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7948 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Blend_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7949 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Modulate }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7950 { 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 }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7951 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Modulate_Blend }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7952 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Modulate_Blend_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7953 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_BGR888_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7954 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGBA8888_BGR888_Blend }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7955 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_BGR888_Blend_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7956 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_RGBA8888_BGR888_Modulate }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7957 { 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 }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7958 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGBA8888_BGR888_Modulate_Blend }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7959 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_BGR888_Modulate_Blend_Scale }, |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7960 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_ARGB8888_Scale }, |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7961 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGBA8888_ARGB8888_Blend }, |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7962 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_ARGB8888_Blend_Scale }, |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7963 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_RGBA8888_ARGB8888_Modulate }, |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7964 { 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 }, |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7965 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGBA8888_ARGB8888_Modulate_Blend }, |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7966 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_ARGB8888_Modulate_Blend_Scale }, |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7967 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7968 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Blend }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7969 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Blend_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7970 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Modulate }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7971 { 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 }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7972 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Modulate_Blend }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7973 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Modulate_Blend_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7974 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_BGR888_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7975 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ABGR8888_BGR888_Blend }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7976 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_BGR888_Blend_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7977 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_ABGR8888_BGR888_Modulate }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7978 { 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 }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7979 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ABGR8888_BGR888_Modulate_Blend }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7980 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_BGR888_Modulate_Blend_Scale }, |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7981 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_ARGB8888_Scale }, |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7982 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ABGR8888_ARGB8888_Blend }, |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7983 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_ARGB8888_Blend_Scale }, |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7984 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_ABGR8888_ARGB8888_Modulate }, |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7985 { 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 }, |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7986 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ABGR8888_ARGB8888_Modulate_Blend }, |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7987 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_ARGB8888_Modulate_Blend_Scale }, |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7988 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7989 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Blend }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7990 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Blend_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7991 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Modulate }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7992 { 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 }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7993 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Modulate_Blend }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7994 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Modulate_Blend_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7995 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_BGR888_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7996 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGRA8888_BGR888_Blend }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7997 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_BGR888_Blend_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7998 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_BGRA8888_BGR888_Modulate }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7999 { 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 }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
8000 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGRA8888_BGR888_Modulate_Blend }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
8001 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_BGR888_Modulate_Blend_Scale }, |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
8002 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_ARGB8888_Scale }, |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
8003 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGRA8888_ARGB8888_Blend }, |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
8004 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_ARGB8888_Blend_Scale }, |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
8005 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_BGRA8888_ARGB8888_Modulate }, |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
8006 { 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 }, |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
8007 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGRA8888_ARGB8888_Modulate_Blend }, |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
8008 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_ARGB8888_Modulate_Blend_Scale }, |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
8009 { 0, 0, 0, 0, NULL } |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
8010 }; |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
8011 |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
8012 /* *INDENT-ON* */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
8013 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
8014 /* vi: set ts=4 sw=4 expandtab: */ |