Mercurial > sdl-ios-xcode
annotate src/video/SDL_blit_auto.c @ 5246:189b1bdb7baf
Surfaces aren't in hardware memory anymore!
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Thu, 10 Feb 2011 05:10:05 -0800 |
parents | d976b67150c5 |
children |
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 |
5143
e743b9c3f6d6
Making the API simpler, the blend modes are "none, blend, add" and are supported by all renderers.
Sam Lantinga <slouken@libsdl.org>
parents:
3697
diff
changeset
|
4 Copyright (C) 1997-2011 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 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
95 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
96 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
97 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
|
98 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
|
99 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
|
100 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
101 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
102 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
|
103 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
|
104 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
|
105 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
106 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
107 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
108 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
109 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
110 break; |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
111 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
112 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
|
113 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
114 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
115 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
116 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
117 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
|
118 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
|
119 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
120 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
121 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
122 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
|
123 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
124 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
|
125 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
126 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
|
127 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
128 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
|
129 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
130 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
131 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
132 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
133 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
134 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
135 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
|
136 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
|
137 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
138 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
139 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
140 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
|
141 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
|
142 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
143 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
144 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
145 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
146 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
147 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
148 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
149 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
150 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
151 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
152 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
153 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
154 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
|
155 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
156 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
157 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
|
158 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
159 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
|
160 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
|
161 /* 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
|
162 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
163 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
164 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
165 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
166 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
167 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
168 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
169 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
170 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
|
171 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
|
172 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
|
173 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
174 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
175 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
|
176 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
|
177 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
|
178 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
179 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
180 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
181 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
182 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
183 break; |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
184 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
185 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
|
186 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
187 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
188 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
189 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
190 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
191 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
|
192 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
193 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
194 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
195 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
|
196 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
197 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
|
198 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
|
199 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
|
200 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
|
201 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
|
202 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
203 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
|
204 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
205 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
206 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
|
207 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
|
208 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
|
209 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
210 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
211 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
|
212 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
|
213 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
214 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
215 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
216 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
217 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
|
218 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
219 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
220 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
|
221 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
222 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
223 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
224 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
225 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
|
226 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
|
227 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
228 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
229 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
230 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
|
231 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
232 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
|
233 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
|
234 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
|
235 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
|
236 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
|
237 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
238 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
|
239 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
240 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
241 int incy, incx; |
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 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
244 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
245 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
|
246 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
|
247 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
248 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
249 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
250 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
|
251 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
|
252 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
253 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
254 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
255 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
256 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
257 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
258 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
259 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
260 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
261 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
262 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
263 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
264 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
|
265 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
266 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
267 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
|
268 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
|
269 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
270 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
271 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
272 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
273 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
|
274 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
275 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
276 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
|
277 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
278 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
279 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
280 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
281 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
282 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
|
283 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
284 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
285 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
286 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
|
287 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
288 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
|
289 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
|
290 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
|
291 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
|
292 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
|
293 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
294 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
|
295 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
296 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
|
297 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
298 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
299 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
|
300 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
|
301 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
|
302 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
303 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
304 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
|
305 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
306 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
|
307 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
|
308 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
309 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
310 srcB = (srcB * modulateB) / 255; |
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 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
|
313 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
314 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
315 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
|
316 /* 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
|
317 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
318 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
319 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
320 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
321 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
322 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
323 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
324 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
325 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
|
326 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
|
327 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
|
328 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
329 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
330 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
|
331 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
|
332 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
|
333 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
334 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
335 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
336 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
337 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
338 break; |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
339 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
340 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
|
341 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
342 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
343 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
344 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
345 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
|
346 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
|
347 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
348 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
349 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
350 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
|
351 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
352 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
|
353 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
|
354 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
|
355 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
|
356 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
|
357 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
358 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
|
359 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
360 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
|
361 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
362 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
363 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
364 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
365 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
366 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
367 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
|
368 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
|
369 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
370 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
371 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
372 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
|
373 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
|
374 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
375 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
376 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
377 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
378 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
379 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
380 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
381 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
382 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
383 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
384 posx -= 0x10000L; |
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 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
|
387 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
388 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
389 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
|
390 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
391 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
|
392 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
|
393 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
394 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
395 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
396 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
397 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
|
398 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
399 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
400 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
|
401 /* 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
|
402 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
403 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
404 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
405 srcB = (srcB * srcA) / 255; |
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 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
408 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
409 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
410 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
|
411 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
|
412 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
|
413 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
414 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
415 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
|
416 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
|
417 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
|
418 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
419 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
420 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
421 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
422 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
423 break; |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
424 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
425 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
|
426 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
427 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
428 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
429 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
430 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
431 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
|
432 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
433 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
434 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
435 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
|
436 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
437 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
|
438 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
439 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
|
440 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
441 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
442 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
443 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
444 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
445 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
446 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
|
447 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
|
448 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
449 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
450 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
451 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
|
452 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
|
453 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
454 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
455 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
456 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
457 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
458 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
459 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
460 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
461 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
462 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
463 posx -= 0x10000L; |
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 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
|
466 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
467 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
468 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
|
469 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
|
470 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
471 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
472 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
473 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
474 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
475 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
|
476 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
477 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
478 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
479 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
|
480 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
481 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
|
482 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
483 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
|
484 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
485 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
|
486 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
487 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
488 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
|
489 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
|
490 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
|
491 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
492 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
493 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
|
494 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
495 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
|
496 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
|
497 /* 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
|
498 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
499 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
500 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
501 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
502 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
503 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
504 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
505 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
506 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
|
507 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
|
508 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
|
509 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
510 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
511 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
|
512 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
|
513 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
|
514 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
515 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
516 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
517 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
518 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
519 break; |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
520 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
521 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
|
522 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
523 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
524 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
525 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
526 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
|
527 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
|
528 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
529 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
530 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
531 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
|
532 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
533 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
|
534 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
535 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
|
536 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
537 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
|
538 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
539 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
540 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
541 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
542 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
543 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
544 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
|
545 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
|
546 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
547 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
548 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
549 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
|
550 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
|
551 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
552 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
553 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
554 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
555 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
556 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
557 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
558 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
559 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
560 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
561 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
562 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
563 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
|
564 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
565 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
566 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
|
567 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
568 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
|
569 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
|
570 /* 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
|
571 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
572 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
573 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
574 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
575 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
576 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
577 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
578 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
579 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
|
580 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
|
581 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
|
582 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
583 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
584 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
|
585 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
|
586 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
|
587 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
588 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
589 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
590 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
591 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
592 break; |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
593 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
594 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
|
595 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
596 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
597 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
598 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
599 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
600 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
|
601 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
602 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
603 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
604 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
|
605 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
606 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
|
607 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
|
608 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
|
609 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
|
610 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
|
611 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
612 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
|
613 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
614 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
615 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
|
616 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
|
617 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
|
618 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
619 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
620 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
|
621 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
|
622 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
623 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
624 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
625 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
626 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
|
627 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
628 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
629 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
|
630 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
631 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
632 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
633 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
634 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
|
635 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
|
636 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
637 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
638 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
639 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
|
640 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
641 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
|
642 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
|
643 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
|
644 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
|
645 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
|
646 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
647 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
|
648 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
649 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
650 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
651 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
652 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
653 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
654 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
|
655 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
|
656 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
657 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
658 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
659 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
|
660 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
|
661 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
662 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
663 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
664 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
665 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
666 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
667 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
668 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
669 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
670 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
671 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
672 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
673 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
|
674 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
675 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
676 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
|
677 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
|
678 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
679 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
680 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
681 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
682 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
|
683 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
684 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
685 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
|
686 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
687 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
688 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
689 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
690 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
691 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
|
692 } |
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 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
695 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
|
696 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
697 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
|
698 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
|
699 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
|
700 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
|
701 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
|
702 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
703 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
|
704 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
705 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
|
706 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
707 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
708 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
|
709 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
|
710 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
|
711 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
712 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
713 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
|
714 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
715 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
|
716 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
|
717 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
718 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
719 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
720 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
721 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
|
722 srcA = (srcA * modulateA) / 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_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
725 /* 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
|
726 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
727 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
728 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
729 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
730 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
731 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
732 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
733 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
734 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
|
735 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
|
736 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
|
737 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
738 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
739 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
|
740 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
|
741 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
|
742 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
743 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
744 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
745 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
746 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
747 break; |
2262
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 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
|
750 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
751 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
752 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
753 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
754 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
|
755 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
|
756 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
757 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
758 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
759 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
|
760 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
761 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
|
762 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
|
763 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
|
764 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
|
765 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
|
766 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
767 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
|
768 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
769 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
|
770 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
771 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
772 int incy, incx; |
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 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
775 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
776 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
|
777 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
|
778 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
779 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
780 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
781 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
|
782 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
|
783 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
784 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
785 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
786 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
787 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
788 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
789 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
790 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
791 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
792 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
793 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
794 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
795 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
|
796 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
797 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
798 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
|
799 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
800 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
|
801 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
|
802 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
803 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
804 srcB = (srcB * modulateB) / 255; |
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 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
|
807 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
808 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
809 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
|
810 /* 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
|
811 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
812 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
813 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
814 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
815 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
816 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
817 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
818 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
819 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
|
820 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
|
821 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
|
822 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
823 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
824 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
|
825 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
|
826 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
|
827 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
828 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
829 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
830 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
831 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
832 break; |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
833 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
834 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
|
835 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
836 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
837 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
838 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
839 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
840 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
|
841 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
842 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
843 |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
844 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
|
845 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
846 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
847 Uint32 pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
848 Uint32 R, G, B, A; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
849 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
850 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
851 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
852 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
853 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
854 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
855 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
|
856 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
|
857 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
858 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
859 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
860 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
861 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
862 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
863 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
864 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
865 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
866 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
867 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
868 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
869 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
870 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
871 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
872 posx -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
873 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
874 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
|
875 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
876 pixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
877 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
|
878 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
|
879 *dst = pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
880 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
881 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
882 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
883 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
884 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
885 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
886 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
887 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
888 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
|
889 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
890 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
891 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
892 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
893 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
894 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
895 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
896 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
897 Uint32 *src = (Uint32 *)info->src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
898 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
899 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
900 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
901 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
902 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
|
903 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
904 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
|
905 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
|
906 /* 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
|
907 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
908 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
909 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
910 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
911 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
912 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
913 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
914 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
915 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
|
916 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
|
917 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
|
918 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
919 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
920 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
|
921 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
|
922 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
|
923 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
924 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
925 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
926 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
927 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
928 break; |
2800
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 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
|
931 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
932 ++src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
933 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
934 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
935 info->src += info->src_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
936 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
937 } |
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 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
940 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
|
941 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
942 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
943 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
944 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
945 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
946 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
947 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
948 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
949 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
950 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
951 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
952 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
953 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
|
954 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
|
955 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
956 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
957 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
958 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
959 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
960 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
961 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
962 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
963 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
964 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
965 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
966 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
967 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
968 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
969 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
970 posx -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
971 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
972 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
|
973 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
974 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
975 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
|
976 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
977 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
|
978 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
|
979 /* 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
|
980 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
981 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
982 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
983 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
984 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
985 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
986 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
987 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
988 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
|
989 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
|
990 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
|
991 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
992 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
993 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
|
994 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
|
995 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
|
996 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
997 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
998 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
999 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
1000 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
1001 break; |
2800
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 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
|
1004 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1005 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1006 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1007 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1008 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1009 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1010 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1011 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1012 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1013 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
|
1014 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1015 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1016 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1017 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1018 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1019 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1020 Uint32 pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1021 Uint32 R, G, B, A; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1022 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1023 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1024 Uint32 *src = (Uint32 *)info->src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1025 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1026 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1027 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1028 pixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1029 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
|
1030 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
|
1031 R = (R * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1032 G = (G * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1033 B = (B * modulateB) / 255; |
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 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
|
1036 A = (A * modulateA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1037 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1038 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
|
1039 *dst = pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1040 ++src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1041 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1042 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1043 info->src += info->src_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1044 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1045 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1046 } |
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 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
|
1049 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1050 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1051 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1052 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1053 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1054 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1055 Uint32 pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1056 Uint32 R, G, B, A; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1057 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1058 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1059 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1060 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1061 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1062 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1063 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
|
1064 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
|
1065 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1066 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1067 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1068 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1069 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1070 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1071 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1072 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1073 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1074 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1075 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1076 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1077 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1078 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1079 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1080 posx -= 0x10000L; |
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 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
|
1083 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1084 pixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1085 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
|
1086 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
|
1087 R = (R * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1088 G = (G * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1089 B = (B * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1090 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1091 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
|
1092 A = (A * modulateA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1093 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1094 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
|
1095 *dst = pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1096 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1097 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1098 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1099 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1100 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1101 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1102 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1103 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1104 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
|
1105 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1106 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1107 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1108 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1109 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1110 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1111 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1112 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1113 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1114 Uint32 dstR, dstG, dstB, dstA; |
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 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1117 Uint32 *src = (Uint32 *)info->src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1118 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1119 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1120 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1121 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1122 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
|
1123 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1124 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
|
1125 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
|
1126 srcR = (srcR * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1127 srcG = (srcG * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1128 srcB = (srcB * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1129 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1130 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
|
1131 srcA = (srcA * modulateA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1132 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1133 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
|
1134 /* 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
|
1135 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1136 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1137 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1138 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1139 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1140 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
1141 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1142 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1143 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
|
1144 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
|
1145 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
|
1146 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1147 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1148 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
|
1149 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
|
1150 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
|
1151 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
1152 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
1153 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
1154 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
1155 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
1156 break; |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1157 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1158 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
|
1159 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1160 ++src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1161 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1162 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1163 info->src += info->src_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1164 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1165 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1166 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1167 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1168 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
|
1169 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1170 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1171 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1172 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1173 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1174 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1175 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1176 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1177 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1178 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1179 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1180 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1181 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1182 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1183 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1184 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1185 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
|
1186 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
|
1187 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1188 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1189 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1190 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1191 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1192 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1193 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1194 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1195 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1196 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1197 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1198 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1199 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1200 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1201 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1202 posx -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1203 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1204 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
|
1205 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1206 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1207 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
|
1208 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1209 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
|
1210 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
|
1211 srcR = (srcR * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1212 srcG = (srcG * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1213 srcB = (srcB * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1214 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1215 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
|
1216 srcA = (srcA * modulateA) / 255; |
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 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
|
1219 /* 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
|
1220 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1221 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1222 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1223 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1224 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1225 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
1226 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1227 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1228 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
|
1229 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
|
1230 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
|
1231 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1232 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1233 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
|
1234 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
|
1235 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
|
1236 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
1237 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
1238 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
1239 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
1240 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
1241 break; |
2800
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 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
|
1244 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1245 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1246 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1247 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1248 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1249 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1250 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1251 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1252 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
1253 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
|
1254 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1255 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
|
1256 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1257 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
|
1258 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1259 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1260 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1261 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1262 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1263 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1264 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
|
1265 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
|
1266 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1267 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1268 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1269 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
|
1270 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
|
1271 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1272 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1273 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1274 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1275 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1276 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1277 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1278 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1279 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1280 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1281 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1282 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1283 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
|
1284 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1285 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1286 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
|
1287 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
|
1288 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1289 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1290 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1291 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1292 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1293 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
|
1294 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1295 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1296 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
1297 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
|
1298 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1299 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
|
1300 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1301 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
|
1302 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1303 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
|
1304 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1305 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1306 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
|
1307 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
|
1308 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
|
1309 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1310 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1311 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
|
1312 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1313 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
|
1314 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
|
1315 /* 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
|
1316 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1317 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1318 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1319 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1320 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1321 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
1322 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1323 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1324 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
|
1325 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
|
1326 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
|
1327 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1328 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1329 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
|
1330 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
|
1331 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
|
1332 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
1333 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
1334 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
1335 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
1336 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
1337 break; |
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 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
|
1340 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1341 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1342 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1343 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1344 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
|
1345 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
|
1346 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1347 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1348 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
1349 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
|
1350 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1351 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
|
1352 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1353 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
|
1354 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1355 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
|
1356 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1357 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1358 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1359 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1360 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1361 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1362 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
|
1363 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
|
1364 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1365 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1366 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1367 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
|
1368 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
|
1369 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1370 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1371 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1372 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1373 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1374 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1375 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1376 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1377 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1378 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1379 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1380 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1381 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
|
1382 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1383 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1384 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
|
1385 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1386 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
|
1387 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
|
1388 /* 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
|
1389 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1390 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1391 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1392 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1393 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1394 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
1395 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1396 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1397 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
|
1398 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
|
1399 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
|
1400 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1401 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1402 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
|
1403 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
|
1404 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
|
1405 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
1406 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
1407 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
1408 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
1409 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
1410 break; |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1411 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1412 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
|
1413 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1414 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1415 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1416 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1417 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1418 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
|
1419 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1420 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1421 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
1422 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
|
1423 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1424 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
|
1425 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
|
1426 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
|
1427 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
|
1428 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
|
1429 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1430 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
|
1431 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1432 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1433 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
|
1434 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
|
1435 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
|
1436 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1437 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1438 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
|
1439 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
|
1440 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1441 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1442 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1443 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1444 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
|
1445 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1446 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1447 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
|
1448 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1449 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1450 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1451 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1452 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
|
1453 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
|
1454 } |
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 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
1457 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
|
1458 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1459 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
|
1460 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
|
1461 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
|
1462 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
|
1463 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
|
1464 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1465 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
|
1466 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1467 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1468 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1469 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1470 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1471 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1472 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
|
1473 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
|
1474 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1475 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1476 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1477 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
|
1478 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
|
1479 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1480 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1481 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1482 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1483 posy -= 0x10000L; |
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 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1486 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1487 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1488 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1489 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1490 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1491 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
|
1492 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1493 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1494 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
|
1495 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
|
1496 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1497 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1498 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1499 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1500 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
|
1501 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1502 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1503 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
|
1504 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1505 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1506 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1507 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1508 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1509 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
|
1510 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1511 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1512 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
1513 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
|
1514 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1515 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
|
1516 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
|
1517 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
|
1518 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
|
1519 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
|
1520 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1521 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
|
1522 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1523 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
|
1524 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1525 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1526 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
|
1527 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
|
1528 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
|
1529 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1530 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1531 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
|
1532 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1533 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
|
1534 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
|
1535 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1536 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1537 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1538 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1539 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
|
1540 srcA = (srcA * modulateA) / 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_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1543 /* 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
|
1544 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1545 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1546 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1547 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1548 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1549 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
1550 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1551 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1552 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
|
1553 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
|
1554 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
|
1555 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1556 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1557 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
|
1558 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
|
1559 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
|
1560 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
1561 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
1562 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
1563 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
1564 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
1565 break; |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1566 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1567 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
|
1568 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1569 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1570 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1571 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1572 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
|
1573 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
|
1574 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1575 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1576 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
1577 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
|
1578 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1579 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
|
1580 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
|
1581 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
|
1582 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
|
1583 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
|
1584 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1585 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
|
1586 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1587 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
|
1588 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1589 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1590 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1591 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1592 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1593 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1594 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
|
1595 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
|
1596 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1597 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1598 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1599 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
|
1600 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
|
1601 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1602 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1603 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1604 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1605 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1606 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1607 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1608 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1609 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1610 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1611 posx -= 0x10000L; |
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 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
|
1614 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1615 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1616 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
|
1617 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1618 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
|
1619 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
|
1620 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1621 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1622 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1623 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1624 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
|
1625 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1626 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1627 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
|
1628 /* 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
|
1629 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1630 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1631 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1632 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1633 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1634 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
1635 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1636 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1637 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
|
1638 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
|
1639 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
|
1640 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1641 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1642 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
|
1643 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
|
1644 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
|
1645 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
1646 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
1647 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
1648 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
1649 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
1650 break; |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1651 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1652 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
|
1653 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1654 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1655 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1656 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1657 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1658 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
|
1659 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1660 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1661 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
1662 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
|
1663 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1664 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
|
1665 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1666 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1667 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1668 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1669 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1670 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1671 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
|
1672 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
|
1673 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1674 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1675 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1676 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
|
1677 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
|
1678 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1679 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1680 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1681 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1682 posy -= 0x10000L; |
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 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1685 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1686 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1687 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1688 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1689 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1690 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
|
1691 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1692 *dst = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1693 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1694 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1695 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1696 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1697 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
|
1698 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1699 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1700 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
1701 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
|
1702 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1703 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
|
1704 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1705 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
|
1706 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1707 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
|
1708 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1709 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1710 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
|
1711 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
|
1712 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
|
1713 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1714 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1715 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
|
1716 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1717 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
|
1718 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
|
1719 /* 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
|
1720 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1721 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1722 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1723 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1724 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1725 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
1726 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1727 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1728 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
|
1729 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
|
1730 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
|
1731 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1732 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1733 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
|
1734 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
|
1735 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
|
1736 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
1737 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
1738 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
1739 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
1740 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
1741 break; |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1742 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1743 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
|
1744 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1745 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1746 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1747 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1748 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
|
1749 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
|
1750 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1751 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1752 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
1753 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
|
1754 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1755 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
|
1756 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1757 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
|
1758 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1759 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
|
1760 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1761 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1762 int incy, incx; |
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 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1765 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1766 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
|
1767 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
|
1768 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1769 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1770 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1771 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
|
1772 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
|
1773 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1774 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1775 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1776 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1777 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1778 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1779 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1780 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1781 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1782 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1783 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1784 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1785 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
|
1786 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1787 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1788 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
|
1789 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1790 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
|
1791 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
|
1792 /* 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
|
1793 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1794 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1795 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1796 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1797 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1798 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
1799 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1800 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1801 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
|
1802 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
|
1803 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
|
1804 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1805 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1806 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
|
1807 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
|
1808 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
|
1809 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
1810 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
1811 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
1812 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
1813 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
1814 break; |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1815 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1816 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
|
1817 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1818 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1819 ++dst; |
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 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1822 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
|
1823 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1824 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1825 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
1826 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
|
1827 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1828 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
|
1829 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
|
1830 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
|
1831 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
|
1832 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
|
1833 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1834 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
|
1835 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1836 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1837 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
|
1838 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
|
1839 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
|
1840 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1841 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1842 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
|
1843 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
|
1844 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1845 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1846 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1847 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1848 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
|
1849 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1850 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1851 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
|
1852 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1853 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1854 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1855 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1856 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
|
1857 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
|
1858 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1859 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1860 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
1861 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
|
1862 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1863 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
|
1864 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
|
1865 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
|
1866 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
|
1867 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
|
1868 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1869 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
|
1870 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1871 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1872 int incy, incx; |
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 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1875 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1876 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
|
1877 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
|
1878 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1879 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1880 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1881 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
|
1882 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
|
1883 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1884 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1885 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1886 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1887 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1888 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1889 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1890 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1891 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1892 ++srcx; |
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 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1895 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
|
1896 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1897 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1898 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
|
1899 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
|
1900 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1901 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1902 B = (B * modulateB) / 255; |
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 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
|
1905 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1906 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1907 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
|
1908 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1909 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1910 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1911 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1912 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1913 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
|
1914 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1915 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1916 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
1917 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
|
1918 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1919 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
|
1920 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
|
1921 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
|
1922 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
|
1923 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
|
1924 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1925 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
|
1926 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1927 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
|
1928 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1929 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1930 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
|
1931 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
|
1932 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
|
1933 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1934 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1935 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
|
1936 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1937 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
|
1938 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
|
1939 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1940 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1941 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1942 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1943 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
|
1944 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1945 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1946 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
|
1947 /* 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
|
1948 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1949 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1950 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1951 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1952 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1953 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
1954 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1955 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1956 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
|
1957 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
|
1958 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
|
1959 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1960 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1961 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
|
1962 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
|
1963 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
|
1964 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
1965 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
1966 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
1967 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
1968 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
1969 break; |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1970 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1971 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
|
1972 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1973 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1974 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1975 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1976 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
|
1977 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
|
1978 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1979 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1980 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
1981 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
|
1982 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1983 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
|
1984 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
|
1985 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
|
1986 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
|
1987 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
|
1988 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1989 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
|
1990 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1991 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
|
1992 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1993 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1994 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1995 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1996 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1997 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1998 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
|
1999 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
|
2000 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2001 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2002 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2003 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
|
2004 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
|
2005 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2006 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2007 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2008 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2009 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2010 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2011 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2012 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2013 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2014 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2015 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2016 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2017 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
|
2018 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2019 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2020 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
|
2021 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2022 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
|
2023 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
|
2024 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2025 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2026 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2027 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2028 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
|
2029 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2030 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2031 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
|
2032 /* 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
|
2033 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2034 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2035 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2036 srcB = (srcB * srcA) / 255; |
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 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
2039 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2040 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2041 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
|
2042 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
|
2043 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
|
2044 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2045 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2046 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
|
2047 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
|
2048 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
|
2049 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
2050 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
2051 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
2052 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
2053 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
2054 break; |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2055 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2056 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
|
2057 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2058 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2059 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2060 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2061 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2062 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
|
2063 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2064 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2065 |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2066 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
|
2067 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2068 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2069 Uint32 pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2070 Uint32 R, G, B, A; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2071 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2072 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2073 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2074 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2075 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2076 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2077 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
|
2078 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
|
2079 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2080 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2081 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2082 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2083 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2084 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2085 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2086 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2087 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2088 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2089 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2090 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2091 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2092 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2093 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2094 posx -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2095 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2096 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
|
2097 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2098 pixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2099 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
|
2100 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
|
2101 *dst = pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2102 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2103 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2104 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2105 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2106 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2107 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2108 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2109 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2110 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
|
2111 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2112 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2113 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2114 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2115 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2116 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2117 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2118 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2119 Uint32 *src = (Uint32 *)info->src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2120 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2121 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2122 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2123 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2124 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
|
2125 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2126 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
|
2127 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
|
2128 /* 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
|
2129 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2130 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2131 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2132 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2133 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2134 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
2135 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2136 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2137 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
|
2138 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
|
2139 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
|
2140 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2141 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2142 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
|
2143 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
|
2144 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
|
2145 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
2146 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
2147 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
2148 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
2149 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
2150 break; |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2151 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2152 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
|
2153 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2154 ++src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2155 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2156 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2157 info->src += info->src_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2158 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2159 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2160 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2161 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2162 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
|
2163 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2164 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2165 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2166 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2167 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2168 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2169 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2170 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2171 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2172 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2173 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2174 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2175 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
|
2176 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
|
2177 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2178 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2179 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2180 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2181 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2182 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2183 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2184 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2185 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2186 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2187 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2188 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2189 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2190 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2191 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2192 posx -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2193 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2194 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
|
2195 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2196 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2197 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
|
2198 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2199 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
|
2200 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
|
2201 /* 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
|
2202 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2203 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2204 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2205 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2206 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2207 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
2208 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2209 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2210 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
|
2211 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
|
2212 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
|
2213 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2214 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2215 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
|
2216 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
|
2217 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
|
2218 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
2219 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
2220 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
2221 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
2222 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
2223 break; |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2224 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2225 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
|
2226 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2227 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2228 ++dst; |
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 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2231 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2232 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2233 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2234 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2235 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
|
2236 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2237 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2238 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2239 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2240 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2241 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2242 Uint32 pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2243 Uint32 R, G, B, A; |
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 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2246 Uint32 *src = (Uint32 *)info->src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2247 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2248 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2249 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2250 pixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2251 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
|
2252 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
|
2253 R = (R * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2254 G = (G * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2255 B = (B * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2256 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2257 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
|
2258 A = (A * modulateA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2259 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2260 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
|
2261 *dst = pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2262 ++src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2263 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2264 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2265 info->src += info->src_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2266 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2267 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2268 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2269 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2270 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
|
2271 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2272 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2273 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2274 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2275 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2276 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2277 Uint32 pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2278 Uint32 R, G, B, A; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2279 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2280 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2281 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2282 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2283 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2284 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2285 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
|
2286 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
|
2287 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2288 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2289 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2290 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2291 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2292 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2293 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2294 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2295 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2296 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2297 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2298 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2299 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2300 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2301 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2302 posx -= 0x10000L; |
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 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
|
2305 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2306 pixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2307 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
|
2308 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
|
2309 R = (R * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2310 G = (G * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2311 B = (B * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2312 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2313 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
|
2314 A = (A * modulateA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2315 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2316 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
|
2317 *dst = pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2318 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2319 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2320 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2321 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2322 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2323 } |
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 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2326 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
|
2327 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2328 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2329 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2330 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2331 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2332 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2333 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2334 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2335 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2336 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2337 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2338 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2339 Uint32 *src = (Uint32 *)info->src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2340 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2341 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2342 while (n--) { |
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_MODULATE_COLOR) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2348 srcR = (srcR * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2349 srcG = (srcG * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2350 srcB = (srcB * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2351 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2352 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
|
2353 srcA = (srcA * modulateA) / 255; |
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 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
|
2356 /* 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
|
2357 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2358 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2359 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2360 srcB = (srcB * srcA) / 255; |
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 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
2363 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2364 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2365 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
|
2366 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
|
2367 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
|
2368 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2369 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2370 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
|
2371 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
|
2372 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
|
2373 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
2374 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
2375 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
2376 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
2377 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
2378 break; |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2379 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2380 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
|
2381 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2382 ++src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2383 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2384 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2385 info->src += info->src_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2386 info->dst += info->dst_pitch; |
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 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2390 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
|
2391 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2392 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2393 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2394 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2395 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2396 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2397 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2398 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2399 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2400 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2401 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2402 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2403 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2404 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2405 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2406 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2407 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
|
2408 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
|
2409 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2410 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2411 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2412 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2413 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2414 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2415 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2416 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2417 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2418 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2419 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2420 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2421 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2422 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2423 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2424 posx -= 0x10000L; |
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 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
|
2427 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2428 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2429 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
|
2430 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2431 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
|
2432 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
|
2433 srcR = (srcR * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2434 srcG = (srcG * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2435 srcB = (srcB * modulateB) / 255; |
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 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
|
2438 srcA = (srcA * modulateA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2439 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2440 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
|
2441 /* 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
|
2442 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2443 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2444 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2445 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2446 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2447 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
2448 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2449 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2450 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
|
2451 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
|
2452 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
|
2453 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2454 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2455 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
|
2456 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
|
2457 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
|
2458 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
2459 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
2460 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
2461 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
2462 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
2463 break; |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2464 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2465 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
|
2466 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2467 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2468 ++dst; |
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 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2471 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2472 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2473 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2474 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
2475 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
|
2476 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2477 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
|
2478 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2479 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
|
2480 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2481 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2482 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2483 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2484 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2485 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2486 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
|
2487 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
|
2488 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2489 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2490 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2491 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
|
2492 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
|
2493 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2494 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2495 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2496 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2497 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2498 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2499 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2500 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2501 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2502 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2503 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2504 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2505 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
|
2506 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2507 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2508 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
|
2509 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
|
2510 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2511 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2512 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2513 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2514 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2515 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
|
2516 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2517 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2518 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
2519 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
|
2520 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2521 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
|
2522 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2523 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
|
2524 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2525 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
|
2526 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2527 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2528 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
|
2529 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
|
2530 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
|
2531 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2532 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2533 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
|
2534 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2535 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
|
2536 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
|
2537 /* 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
|
2538 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2539 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2540 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2541 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2542 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2543 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
2544 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2545 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2546 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
|
2547 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
|
2548 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
|
2549 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2550 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2551 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
|
2552 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
|
2553 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
|
2554 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
2555 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
2556 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
2557 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
2558 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
2559 break; |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2560 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2561 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
|
2562 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2563 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2564 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2565 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2566 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
|
2567 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
|
2568 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2569 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2570 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
2571 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
|
2572 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2573 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
|
2574 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2575 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
|
2576 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2577 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
|
2578 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2579 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2580 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2581 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2582 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2583 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2584 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
|
2585 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
|
2586 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2587 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2588 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2589 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
|
2590 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
|
2591 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2592 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2593 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2594 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2595 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2596 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2597 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2598 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2599 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2600 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2601 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2602 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2603 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
|
2604 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2605 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2606 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
|
2607 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2608 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
|
2609 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
|
2610 /* 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
|
2611 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2612 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2613 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2614 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2615 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2616 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
2617 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2618 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2619 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
|
2620 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
|
2621 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
|
2622 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2623 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2624 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
|
2625 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
|
2626 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
|
2627 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
2628 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
2629 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
2630 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
2631 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
2632 break; |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2633 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2634 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
|
2635 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2636 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2637 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2638 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2639 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2640 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
|
2641 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2642 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2643 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
2644 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
|
2645 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2646 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
|
2647 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
|
2648 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
|
2649 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
|
2650 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
|
2651 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2652 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
|
2653 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2654 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2655 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
|
2656 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
|
2657 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
|
2658 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2659 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2660 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
|
2661 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
|
2662 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2663 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2664 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2665 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2666 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
|
2667 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2668 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2669 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
|
2670 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2671 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2672 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2673 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2674 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
|
2675 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
|
2676 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2677 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2678 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
2679 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
|
2680 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2681 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
|
2682 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
|
2683 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
|
2684 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
|
2685 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
|
2686 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2687 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
|
2688 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2689 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2690 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2691 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2692 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2693 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2694 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
|
2695 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
|
2696 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2697 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2698 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2699 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
|
2700 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
|
2701 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2702 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2703 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2704 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2705 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2706 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2707 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2708 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2709 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2710 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2711 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2712 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2713 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
|
2714 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2715 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2716 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
|
2717 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
|
2718 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2719 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2720 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2721 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2722 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
|
2723 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2724 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2725 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
|
2726 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2727 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2728 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2729 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2730 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2731 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
|
2732 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2733 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2734 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
2735 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
|
2736 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2737 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
|
2738 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
|
2739 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
|
2740 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
|
2741 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
|
2742 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2743 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
|
2744 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2745 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
|
2746 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2747 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2748 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
|
2749 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
|
2750 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
|
2751 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2752 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2753 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
|
2754 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2755 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
|
2756 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
|
2757 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2758 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2759 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2760 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2761 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
|
2762 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2763 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2764 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
|
2765 /* 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
|
2766 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2767 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2768 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2769 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2770 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2771 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
2772 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2773 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2774 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
|
2775 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
|
2776 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
|
2777 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2778 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2779 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
|
2780 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
|
2781 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
|
2782 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
2783 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
2784 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
2785 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
2786 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
2787 break; |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2788 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2789 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
|
2790 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2791 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2792 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2793 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2794 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
|
2795 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
|
2796 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2797 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2798 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
2799 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
|
2800 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2801 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
|
2802 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
|
2803 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
|
2804 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
|
2805 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
|
2806 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2807 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
|
2808 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2809 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
|
2810 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2811 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2812 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2813 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2814 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2815 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2816 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
|
2817 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
|
2818 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2819 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2820 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2821 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
|
2822 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
|
2823 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2824 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2825 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2826 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2827 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2828 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2829 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2830 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2831 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2832 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2833 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2834 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2835 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
|
2836 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2837 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2838 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
|
2839 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2840 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
|
2841 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
|
2842 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2843 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2844 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2845 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2846 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
|
2847 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2848 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2849 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
|
2850 /* 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
|
2851 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2852 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2853 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2854 srcB = (srcB * srcA) / 255; |
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 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
2857 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2858 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2859 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
|
2860 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
|
2861 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
|
2862 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2863 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2864 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
|
2865 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
|
2866 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
|
2867 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
2868 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
2869 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
2870 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
2871 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
2872 break; |
2262
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 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
|
2875 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2876 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2877 ++dst; |
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 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2880 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
|
2881 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2882 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2883 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
2884 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
|
2885 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2886 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
|
2887 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2888 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
|
2889 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2890 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2891 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2892 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2893 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2894 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2895 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
|
2896 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
|
2897 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2898 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2899 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2900 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
|
2901 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
|
2902 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2903 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2904 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2905 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2906 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2907 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2908 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2909 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2910 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2911 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2912 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2913 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2914 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
|
2915 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2916 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2917 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
|
2918 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
|
2919 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2920 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2921 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2922 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2923 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2924 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
|
2925 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2926 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2927 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
2928 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
|
2929 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2930 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
|
2931 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2932 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
|
2933 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2934 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
|
2935 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2936 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2937 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
|
2938 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
|
2939 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
|
2940 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2941 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2942 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
|
2943 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2944 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
|
2945 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
|
2946 /* 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
|
2947 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2948 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2949 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2950 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2951 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2952 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
2953 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2954 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2955 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
|
2956 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
|
2957 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
|
2958 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2959 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2960 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
|
2961 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
|
2962 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
|
2963 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
2964 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
2965 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
2966 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
2967 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
2968 break; |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2969 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2970 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
|
2971 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2972 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2973 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2974 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2975 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
|
2976 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
|
2977 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2978 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2979 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
2980 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
|
2981 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2982 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
|
2983 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2984 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
|
2985 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2986 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
|
2987 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2988 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2989 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2990 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2991 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2992 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2993 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
|
2994 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
|
2995 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2996 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2997 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2998 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
|
2999 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
|
3000 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3001 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3002 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3003 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3004 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3005 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3006 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3007 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3008 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3009 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3010 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3011 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3012 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
|
3013 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3014 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3015 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
|
3016 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3017 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
|
3018 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
|
3019 /* 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
|
3020 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3021 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3022 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3023 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3024 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3025 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
3026 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3027 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3028 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
|
3029 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
|
3030 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
|
3031 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3032 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3033 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
|
3034 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
|
3035 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
|
3036 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
3037 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
3038 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
3039 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
3040 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
3041 break; |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3042 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3043 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
|
3044 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3045 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3046 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3047 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3048 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3049 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
|
3050 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3051 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3052 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
3053 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
|
3054 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3055 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
|
3056 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
|
3057 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
|
3058 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
|
3059 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
|
3060 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3061 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
|
3062 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3063 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3064 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
|
3065 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
|
3066 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
|
3067 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3068 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3069 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
|
3070 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
|
3071 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3072 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3073 B = (B * modulateB) / 255; |
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 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
|
3076 A = (A * modulateA) / 255; |
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 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
|
3079 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3080 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3081 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3082 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3083 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
|
3084 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
|
3085 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3086 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3087 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
3088 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
|
3089 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3090 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
|
3091 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
|
3092 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
|
3093 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
|
3094 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
|
3095 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3096 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
|
3097 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3098 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3099 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3100 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3101 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3102 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3103 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
|
3104 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
|
3105 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3106 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3107 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3108 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
|
3109 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
|
3110 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3111 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3112 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3113 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3114 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3115 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3116 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3117 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3118 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3119 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3120 posx -= 0x10000L; |
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 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
|
3123 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3124 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3125 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
|
3126 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
|
3127 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3128 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3129 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3130 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3131 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
|
3132 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3133 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3134 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
|
3135 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3136 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3137 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3138 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3139 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3140 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
|
3141 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3142 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3143 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
3144 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
|
3145 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3146 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
|
3147 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
|
3148 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
|
3149 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
|
3150 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
|
3151 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3152 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
|
3153 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3154 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
|
3155 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3156 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3157 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
|
3158 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
|
3159 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
|
3160 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3161 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3162 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
|
3163 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3164 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
|
3165 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
|
3166 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3167 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3168 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3169 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3170 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
|
3171 srcA = (srcA * modulateA) / 255; |
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 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
|
3174 /* 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
|
3175 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3176 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3177 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3178 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3179 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3180 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
3181 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3182 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3183 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
|
3184 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
|
3185 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
|
3186 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3187 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3188 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
|
3189 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
|
3190 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
|
3191 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
3192 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
3193 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
3194 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
3195 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
3196 break; |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3197 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3198 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
|
3199 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3200 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3201 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3202 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3203 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
|
3204 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
|
3205 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3206 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3207 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
3208 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
|
3209 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3210 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
|
3211 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
|
3212 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
|
3213 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
|
3214 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
|
3215 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3216 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
|
3217 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3218 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
|
3219 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3220 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3221 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3222 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3223 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3224 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3225 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
|
3226 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
|
3227 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3228 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3229 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3230 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
|
3231 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
|
3232 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3233 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3234 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3235 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3236 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3237 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3238 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3239 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3240 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3241 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3242 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3243 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3244 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
|
3245 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3246 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3247 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
|
3248 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3249 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
|
3250 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
|
3251 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3252 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3253 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3254 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3255 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
|
3256 srcA = (srcA * modulateA) / 255; |
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 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
|
3259 /* 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
|
3260 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3261 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3262 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3263 srcB = (srcB * srcA) / 255; |
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 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
3266 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3267 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3268 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
|
3269 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
|
3270 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
|
3271 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3272 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3273 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
|
3274 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
|
3275 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
|
3276 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
3277 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
3278 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
3279 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
3280 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
3281 break; |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3282 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3283 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
|
3284 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3285 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3286 ++dst; |
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 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3289 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
|
3290 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3291 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3292 |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3293 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
|
3294 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3295 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3296 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3297 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3298 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3299 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3300 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3301 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3302 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
|
3303 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
|
3304 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3305 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3306 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3307 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3308 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3309 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3310 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3311 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3312 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3313 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3314 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3315 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3316 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3317 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3318 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3319 posx -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3320 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3321 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
|
3322 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3323 *dst = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3324 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3325 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3326 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3327 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3328 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3329 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3330 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3331 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3332 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
|
3333 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3334 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3335 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3336 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3337 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3338 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3339 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3340 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3341 Uint32 *src = (Uint32 *)info->src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3342 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3343 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3344 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3345 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3346 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
|
3347 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3348 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
|
3349 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
|
3350 /* 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
|
3351 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3352 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3353 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3354 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3355 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3356 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
3357 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3358 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3359 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
|
3360 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
|
3361 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
|
3362 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3363 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3364 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
|
3365 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
|
3366 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
|
3367 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
3368 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
3369 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
3370 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
3371 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
3372 break; |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3373 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3374 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
|
3375 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3376 ++src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3377 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3378 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3379 info->src += info->src_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3380 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3381 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3382 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3383 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3384 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
|
3385 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3386 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3387 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3388 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3389 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3390 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3391 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3392 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3393 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3394 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3395 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3396 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3397 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
|
3398 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
|
3399 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3400 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3401 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3402 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3403 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3404 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3405 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3406 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3407 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3408 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3409 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3410 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3411 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3412 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3413 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3414 posx -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3415 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3416 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
|
3417 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3418 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3419 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
|
3420 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3421 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
|
3422 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
|
3423 /* 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
|
3424 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3425 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3426 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3427 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3428 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3429 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
3430 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3431 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3432 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
|
3433 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
|
3434 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
|
3435 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3436 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3437 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
|
3438 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
|
3439 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
|
3440 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
3441 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
3442 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
3443 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
3444 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
3445 break; |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3446 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3447 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
|
3448 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3449 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3450 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3451 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3452 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3453 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3454 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3455 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3456 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3457 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
|
3458 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3459 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3460 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3461 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3462 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3463 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3464 Uint32 pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3465 Uint32 R, G, B, A; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3466 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3467 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3468 Uint32 *src = (Uint32 *)info->src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3469 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3470 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3471 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3472 pixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3473 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
|
3474 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
|
3475 R = (R * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3476 G = (G * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3477 B = (B * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3478 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3479 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
|
3480 A = (A * modulateA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3481 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3482 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
|
3483 *dst = pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3484 ++src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3485 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3486 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3487 info->src += info->src_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3488 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3489 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3490 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3491 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3492 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
|
3493 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3494 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3495 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3496 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3497 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3498 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3499 Uint32 pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3500 Uint32 R, G, B, A; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3501 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3502 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3503 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3504 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3505 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3506 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3507 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
|
3508 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
|
3509 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3510 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3511 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3512 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3513 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3514 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3515 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3516 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3517 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3518 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3519 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3520 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3521 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3522 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3523 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3524 posx -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3525 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3526 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
|
3527 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3528 pixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3529 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
|
3530 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
|
3531 R = (R * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3532 G = (G * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3533 B = (B * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3534 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3535 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
|
3536 A = (A * modulateA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3537 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3538 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
|
3539 *dst = pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3540 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3541 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3542 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3543 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3544 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3545 } |
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 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3548 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
|
3549 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3550 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3551 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3552 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3553 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3554 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3555 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3556 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3557 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3558 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3559 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3560 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3561 Uint32 *src = (Uint32 *)info->src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3562 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3563 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3564 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3565 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3566 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
|
3567 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3568 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
|
3569 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
|
3570 srcR = (srcR * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3571 srcG = (srcG * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3572 srcB = (srcB * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3573 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3574 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
|
3575 srcA = (srcA * modulateA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3576 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3577 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
|
3578 /* 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
|
3579 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3580 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3581 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3582 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3583 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3584 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
3585 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3586 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3587 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
|
3588 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
|
3589 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
|
3590 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3591 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3592 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
|
3593 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
|
3594 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
|
3595 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
3596 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
3597 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
3598 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
3599 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
3600 break; |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3601 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3602 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
|
3603 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3604 ++src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3605 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3606 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3607 info->src += info->src_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3608 info->dst += info->dst_pitch; |
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 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3611 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3612 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
|
3613 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3614 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3615 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3616 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3617 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3618 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3619 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3620 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3621 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3622 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3623 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3624 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3625 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3626 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3627 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3628 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3629 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
|
3630 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
|
3631 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3632 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3633 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3634 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3635 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3636 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3637 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3638 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3639 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3640 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3641 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3642 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3643 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3644 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3645 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3646 posx -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3647 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3648 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
|
3649 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3650 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3651 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
|
3652 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3653 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
|
3654 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
|
3655 srcR = (srcR * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3656 srcG = (srcG * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3657 srcB = (srcB * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3658 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3659 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
|
3660 srcA = (srcA * modulateA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3661 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3662 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
|
3663 /* 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
|
3664 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3665 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3666 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3667 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3668 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3669 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
3670 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3671 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3672 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
|
3673 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
|
3674 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
|
3675 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3676 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3677 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
|
3678 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
|
3679 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
|
3680 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
3681 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
3682 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
3683 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
3684 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
3685 break; |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3686 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3687 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
|
3688 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3689 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3690 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3691 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3692 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3693 info->dst += info->dst_pitch; |
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 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3696 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
3697 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
|
3698 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3699 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
|
3700 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3701 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
|
3702 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3703 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3704 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3705 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3706 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3707 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3708 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
|
3709 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
|
3710 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3711 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3712 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3713 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
|
3714 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
|
3715 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3716 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3717 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3718 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3719 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3720 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3721 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3722 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3723 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3724 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3725 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3726 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3727 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
|
3728 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3729 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3730 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
|
3731 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
|
3732 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3733 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3734 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3735 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3736 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3737 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
|
3738 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3739 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3740 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
3741 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
|
3742 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3743 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
|
3744 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3745 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
|
3746 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3747 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
|
3748 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3749 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3750 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
|
3751 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
|
3752 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
|
3753 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3754 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3755 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
|
3756 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3757 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
|
3758 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
|
3759 /* 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
|
3760 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3761 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3762 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3763 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3764 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3765 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
3766 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3767 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3768 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
|
3769 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
|
3770 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
|
3771 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3772 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3773 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
|
3774 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
|
3775 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
|
3776 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
3777 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
3778 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
3779 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
3780 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
3781 break; |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3782 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3783 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
|
3784 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3785 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3786 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3787 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3788 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
|
3789 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
|
3790 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3791 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3792 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
3793 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
|
3794 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3795 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
|
3796 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3797 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
|
3798 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3799 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
|
3800 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3801 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3802 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3803 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3804 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3805 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3806 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
|
3807 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
|
3808 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3809 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3810 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3811 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
|
3812 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
|
3813 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3814 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3815 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3816 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3817 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3818 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3819 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3820 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3821 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3822 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3823 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3824 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3825 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
|
3826 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3827 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3828 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
|
3829 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3830 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
|
3831 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
|
3832 /* 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
|
3833 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3834 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3835 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3836 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3837 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3838 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
3839 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3840 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3841 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
|
3842 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
|
3843 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
|
3844 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3845 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3846 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
|
3847 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
|
3848 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
|
3849 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
3850 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
3851 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
3852 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
3853 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
3854 break; |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3855 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3856 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
|
3857 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3858 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3859 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3860 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3861 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3862 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
|
3863 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3864 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3865 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
3866 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
|
3867 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3868 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
|
3869 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
|
3870 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
|
3871 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
|
3872 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
|
3873 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3874 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
|
3875 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3876 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3877 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
|
3878 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
|
3879 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
|
3880 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3881 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3882 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
|
3883 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
|
3884 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3885 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3886 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3887 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3888 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
|
3889 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3890 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3891 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
|
3892 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3893 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3894 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3895 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3896 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
|
3897 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
|
3898 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3899 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3900 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
3901 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
|
3902 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3903 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
|
3904 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
|
3905 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
|
3906 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
|
3907 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
|
3908 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3909 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
|
3910 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3911 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3912 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3913 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3914 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3915 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3916 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
|
3917 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
|
3918 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3919 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3920 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3921 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
|
3922 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
|
3923 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3924 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3925 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3926 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3927 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3928 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3929 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3930 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3931 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3932 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3933 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3934 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3935 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
|
3936 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3937 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3938 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
|
3939 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
|
3940 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3941 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3942 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3943 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3944 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
|
3945 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3946 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3947 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
|
3948 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3949 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3950 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3951 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3952 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3953 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
|
3954 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3955 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3956 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
3957 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
|
3958 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3959 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
|
3960 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
|
3961 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
|
3962 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
|
3963 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
|
3964 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3965 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
|
3966 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3967 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
|
3968 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3969 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3970 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
|
3971 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
|
3972 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
|
3973 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3974 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3975 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
|
3976 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3977 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
|
3978 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
|
3979 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3980 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3981 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3982 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3983 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
|
3984 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3985 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3986 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
|
3987 /* 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
|
3988 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3989 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3990 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3991 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3992 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3993 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
3994 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3995 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3996 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
|
3997 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
|
3998 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
|
3999 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4000 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4001 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
|
4002 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
|
4003 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
|
4004 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
4005 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
4006 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
4007 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
4008 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
4009 break; |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4010 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4011 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
|
4012 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4013 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4014 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4015 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4016 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
|
4017 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
|
4018 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4019 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4020 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
4021 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
|
4022 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4023 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
|
4024 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
|
4025 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
|
4026 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
|
4027 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
|
4028 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4029 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
|
4030 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4031 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
|
4032 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4033 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4034 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4035 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4036 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4037 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4038 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
|
4039 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
|
4040 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4041 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4042 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4043 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
|
4044 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
|
4045 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4046 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4047 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4048 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4049 posy -= 0x10000L; |
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 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4052 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4053 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4054 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4055 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4056 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4057 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
|
4058 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4059 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4060 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
|
4061 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4062 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
|
4063 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
|
4064 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4065 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4066 srcB = (srcB * modulateB) / 255; |
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 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
|
4069 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4070 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4071 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
|
4072 /* 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
|
4073 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4074 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4075 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4076 srcB = (srcB * srcA) / 255; |
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 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
4079 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4080 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4081 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
|
4082 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
|
4083 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
|
4084 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4085 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4086 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
|
4087 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
|
4088 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
|
4089 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
4090 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
4091 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
4092 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
4093 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
4094 break; |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4095 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4096 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
|
4097 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4098 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4099 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4100 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4101 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4102 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
|
4103 } |
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 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
4106 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
|
4107 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4108 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
|
4109 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4110 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
|
4111 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4112 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4113 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4114 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4115 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4116 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4117 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
|
4118 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
|
4119 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4120 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4121 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4122 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
|
4123 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
|
4124 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4125 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4126 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4127 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4128 posy -= 0x10000L; |
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 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4131 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4132 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4133 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4134 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4135 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4136 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
|
4137 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4138 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4139 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
|
4140 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
|
4141 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4142 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4143 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4144 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4145 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4146 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
|
4147 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4148 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4149 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
4150 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
|
4151 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4152 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
|
4153 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4154 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
|
4155 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4156 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
|
4157 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4158 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4159 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
|
4160 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
|
4161 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
|
4162 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4163 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4164 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
|
4165 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4166 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
|
4167 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
|
4168 /* 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
|
4169 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4170 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4171 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4172 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4173 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4174 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
4175 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4176 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4177 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
|
4178 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
|
4179 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
|
4180 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4181 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4182 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
|
4183 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
|
4184 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
|
4185 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
4186 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
4187 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
4188 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
4189 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
4190 break; |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4191 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4192 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
|
4193 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4194 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4195 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4196 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4197 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
|
4198 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
|
4199 } |
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 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
4202 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
|
4203 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4204 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
|
4205 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4206 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
|
4207 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4208 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
|
4209 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4210 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4211 int incy, incx; |
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 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4214 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4215 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
|
4216 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
|
4217 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4218 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4219 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4220 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
|
4221 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
|
4222 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4223 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4224 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4225 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4226 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4227 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4228 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4229 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4230 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4231 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4232 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4233 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4234 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
|
4235 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4236 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4237 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
|
4238 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4239 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
|
4240 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
|
4241 /* 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
|
4242 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4243 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4244 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4245 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4246 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4247 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
4248 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4249 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4250 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
|
4251 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
|
4252 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
|
4253 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4254 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4255 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
|
4256 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
|
4257 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
|
4258 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
4259 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
4260 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
4261 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
4262 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
4263 break; |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4264 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4265 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
|
4266 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4267 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4268 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4269 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4270 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4271 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
|
4272 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4273 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4274 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
4275 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
|
4276 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4277 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
|
4278 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
|
4279 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
|
4280 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
|
4281 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
|
4282 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4283 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
|
4284 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4285 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4286 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
|
4287 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
|
4288 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
|
4289 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4290 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4291 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
|
4292 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
|
4293 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4294 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4295 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4296 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4297 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
|
4298 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4299 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4300 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
|
4301 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4302 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4303 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4304 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4305 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
|
4306 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
|
4307 } |
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 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
4310 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
|
4311 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4312 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
|
4313 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
|
4314 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
|
4315 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
|
4316 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
|
4317 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4318 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
|
4319 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4320 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4321 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4322 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4323 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4324 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4325 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
|
4326 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
|
4327 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4328 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4329 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4330 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
|
4331 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
|
4332 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4333 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4334 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4335 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4336 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4337 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4338 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4339 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4340 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4341 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4342 posx -= 0x10000L; |
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 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
|
4345 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4346 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4347 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
|
4348 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
|
4349 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4350 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4351 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4352 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4353 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
|
4354 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4355 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4356 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
|
4357 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4358 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4359 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4360 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4361 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4362 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
|
4363 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4364 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4365 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
4366 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
|
4367 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4368 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
|
4369 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
|
4370 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
|
4371 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
|
4372 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
|
4373 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4374 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
|
4375 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4376 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
|
4377 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4378 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4379 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
|
4380 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
|
4381 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
|
4382 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4383 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4384 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
|
4385 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4386 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
|
4387 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
|
4388 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4389 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4390 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4391 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4392 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
|
4393 srcA = (srcA * modulateA) / 255; |
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 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
|
4396 /* 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
|
4397 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4398 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4399 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4400 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4401 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4402 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
4403 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4404 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4405 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
|
4406 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
|
4407 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
|
4408 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4409 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4410 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
|
4411 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
|
4412 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
|
4413 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
4414 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
4415 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
4416 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
4417 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
4418 break; |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4419 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4420 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
|
4421 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4422 ++src; |
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 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
|
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_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
|
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 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
|
4434 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
|
4435 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
|
4436 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
|
4437 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4438 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
|
4439 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4440 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
|
4441 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4442 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4443 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4444 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4445 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4446 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4447 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
|
4448 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
|
4449 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4450 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4451 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4452 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
|
4453 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
|
4454 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4455 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4456 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4457 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4458 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4459 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4460 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4461 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4462 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4463 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4464 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4465 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4466 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
|
4467 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4468 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4469 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
|
4470 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4471 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
|
4472 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
|
4473 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4474 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4475 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4476 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4477 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
|
4478 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4479 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4480 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
|
4481 /* 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
|
4482 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4483 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4484 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4485 srcB = (srcB * srcA) / 255; |
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 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
4488 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4489 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4490 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
|
4491 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
|
4492 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
|
4493 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4494 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4495 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
|
4496 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
|
4497 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
|
4498 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
4499 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
4500 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
4501 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
4502 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
4503 break; |
2262
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 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
|
4506 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4507 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4508 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4509 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4510 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4511 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
|
4512 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4513 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4514 |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4515 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
|
4516 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4517 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4518 Uint32 pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4519 Uint32 R, G, B, A; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4520 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4521 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4522 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4523 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4524 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4525 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4526 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
|
4527 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
|
4528 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4529 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4530 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4531 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4532 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4533 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4534 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4535 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4536 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4537 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4538 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4539 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4540 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4541 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4542 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4543 posx -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4544 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4545 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
|
4546 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4547 pixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4548 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
|
4549 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
|
4550 *dst = pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4551 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4552 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4553 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4554 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4555 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4556 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4557 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4558 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4559 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
|
4560 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4561 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4562 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4563 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4564 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4565 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4566 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4567 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4568 Uint32 *src = (Uint32 *)info->src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4569 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4570 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4571 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4572 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4573 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
|
4574 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4575 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
|
4576 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
|
4577 /* 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
|
4578 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4579 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4580 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4581 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4582 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4583 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
4584 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4585 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4586 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
|
4587 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
|
4588 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
|
4589 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4590 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4591 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
|
4592 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
|
4593 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
|
4594 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
4595 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
4596 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
4597 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
4598 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
4599 break; |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4600 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4601 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
|
4602 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4603 ++src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4604 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4605 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4606 info->src += info->src_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4607 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4608 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4609 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4610 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4611 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
|
4612 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4613 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4614 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4615 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4616 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4617 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4618 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4619 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4620 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4621 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4622 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4623 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4624 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
|
4625 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
|
4626 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4627 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4628 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4629 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4630 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4631 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4632 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4633 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4634 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4635 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4636 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4637 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4638 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4639 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4640 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4641 posx -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4642 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4643 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
|
4644 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4645 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4646 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
|
4647 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4648 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
|
4649 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
|
4650 /* 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
|
4651 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4652 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4653 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4654 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4655 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4656 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
4657 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4658 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4659 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
|
4660 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
|
4661 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
|
4662 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4663 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4664 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
|
4665 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
|
4666 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
|
4667 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
4668 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
4669 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
4670 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
4671 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
4672 break; |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4673 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4674 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
|
4675 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4676 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4677 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4678 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4679 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4680 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4681 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4682 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4683 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4684 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
|
4685 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4686 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4687 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4688 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4689 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4690 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4691 Uint32 pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4692 Uint32 R, G, B, A; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4693 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4694 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4695 Uint32 *src = (Uint32 *)info->src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4696 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4697 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4698 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4699 pixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4700 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
|
4701 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
|
4702 R = (R * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4703 G = (G * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4704 B = (B * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4705 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4706 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
|
4707 A = (A * modulateA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4708 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4709 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
|
4710 *dst = pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4711 ++src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4712 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4713 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4714 info->src += info->src_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4715 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4716 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4717 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4718 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4719 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
|
4720 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4721 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4722 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4723 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4724 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4725 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4726 Uint32 pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4727 Uint32 R, G, B, A; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4728 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4729 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4730 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4731 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4732 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4733 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4734 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
|
4735 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
|
4736 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4737 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4738 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4739 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4740 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4741 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4742 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4743 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4744 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4745 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4746 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4747 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4748 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4749 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4750 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4751 posx -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4752 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4753 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
|
4754 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4755 pixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4756 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
|
4757 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
|
4758 R = (R * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4759 G = (G * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4760 B = (B * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4761 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4762 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
|
4763 A = (A * modulateA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4764 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4765 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
|
4766 *dst = pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4767 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4768 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4769 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4770 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4771 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4772 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4773 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4774 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4775 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
|
4776 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4777 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4778 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4779 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4780 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4781 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4782 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4783 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4784 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4785 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4786 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4787 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4788 Uint32 *src = (Uint32 *)info->src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4789 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4790 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4791 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4792 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4793 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
|
4794 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4795 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
|
4796 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
|
4797 srcR = (srcR * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4798 srcG = (srcG * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4799 srcB = (srcB * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4800 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4801 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
|
4802 srcA = (srcA * modulateA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4803 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4804 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
|
4805 /* 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
|
4806 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4807 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4808 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4809 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4810 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4811 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
4812 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4813 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4814 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
|
4815 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
|
4816 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
|
4817 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4818 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4819 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
|
4820 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
|
4821 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
|
4822 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
4823 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
4824 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
4825 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
4826 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
4827 break; |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4828 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4829 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
|
4830 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4831 ++src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4832 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4833 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4834 info->src += info->src_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4835 info->dst += info->dst_pitch; |
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 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4838 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4839 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
|
4840 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4841 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4842 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4843 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4844 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4845 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4846 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4847 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4848 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4849 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4850 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4851 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4852 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4853 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4854 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4855 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4856 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
|
4857 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
|
4858 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4859 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4860 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4861 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4862 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4863 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4864 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4865 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4866 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4867 posy -= 0x10000L; |
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 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4870 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4871 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4872 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4873 posx -= 0x10000L; |
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 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
|
4876 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4877 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4878 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
|
4879 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4880 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
|
4881 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
|
4882 srcR = (srcR * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4883 srcG = (srcG * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4884 srcB = (srcB * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4885 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4886 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
|
4887 srcA = (srcA * modulateA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4888 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4889 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
|
4890 /* 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
|
4891 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4892 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4893 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4894 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4895 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4896 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
4897 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4898 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4899 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
|
4900 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
|
4901 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
|
4902 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4903 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4904 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
|
4905 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
|
4906 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
|
4907 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
4908 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
4909 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
4910 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
4911 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
4912 break; |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4913 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4914 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
|
4915 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4916 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4917 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4918 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4919 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4920 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4921 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4922 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4923 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
4924 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
|
4925 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4926 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
|
4927 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4928 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
|
4929 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4930 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4931 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4932 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4933 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4934 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4935 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
|
4936 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
|
4937 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4938 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4939 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4940 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
|
4941 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
|
4942 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4943 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4944 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4945 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4946 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4947 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4948 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4949 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4950 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4951 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4952 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4953 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4954 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
|
4955 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4956 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4957 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
|
4958 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
|
4959 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4960 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4961 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4962 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4963 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4964 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
|
4965 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4966 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4967 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
4968 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
|
4969 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4970 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
|
4971 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4972 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
|
4973 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4974 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
|
4975 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4976 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4977 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
|
4978 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
|
4979 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
|
4980 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4981 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4982 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
|
4983 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4984 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
|
4985 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
|
4986 /* 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
|
4987 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4988 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4989 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4990 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4991 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4992 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
4993 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4994 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4995 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
|
4996 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
|
4997 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
|
4998 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4999 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5000 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
|
5001 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
|
5002 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
|
5003 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
5004 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
5005 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
5006 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
5007 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
5008 break; |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5009 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5010 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
|
5011 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5012 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5013 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5014 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5015 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
|
5016 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
|
5017 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5018 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5019 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5020 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
|
5021 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5022 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
|
5023 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5024 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
|
5025 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5026 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
|
5027 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5028 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5029 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5030 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5031 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5032 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5033 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
|
5034 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
|
5035 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5036 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5037 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5038 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
|
5039 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
|
5040 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5041 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5042 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5043 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5044 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5045 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5046 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5047 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5048 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5049 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5050 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5051 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5052 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
|
5053 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5054 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5055 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
|
5056 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5057 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
|
5058 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
|
5059 /* 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
|
5060 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5061 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5062 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5063 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5064 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5065 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
5066 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5067 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5068 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
|
5069 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
|
5070 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
|
5071 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5072 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5073 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
|
5074 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
|
5075 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
|
5076 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
5077 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
5078 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
5079 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
5080 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
5081 break; |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5082 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5083 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
|
5084 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5085 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5086 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5087 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5088 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5089 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
|
5090 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5091 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5092 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5093 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
|
5094 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5095 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
|
5096 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
|
5097 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
|
5098 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
|
5099 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
|
5100 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5101 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
|
5102 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5103 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5104 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
|
5105 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
|
5106 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
|
5107 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5108 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5109 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
|
5110 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
|
5111 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5112 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5113 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5114 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5115 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
|
5116 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5117 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5118 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
|
5119 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5120 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5121 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5122 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5123 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
|
5124 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
|
5125 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5126 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5127 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5128 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
|
5129 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5130 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
|
5131 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
|
5132 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
|
5133 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
|
5134 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
|
5135 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5136 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
|
5137 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5138 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5139 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5140 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5141 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5142 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5143 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
|
5144 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
|
5145 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5146 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5147 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5148 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
|
5149 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
|
5150 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5151 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5152 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5153 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5154 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5155 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5156 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5157 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5158 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5159 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5160 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5161 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5162 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
|
5163 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5164 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5165 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
|
5166 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
|
5167 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5168 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5169 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5170 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5171 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
|
5172 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5173 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5174 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
|
5175 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5176 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5177 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5178 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5179 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5180 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
|
5181 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5182 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5183 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5184 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
|
5185 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5186 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
|
5187 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
|
5188 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
|
5189 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
|
5190 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
|
5191 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5192 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
|
5193 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5194 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
|
5195 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5196 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5197 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
|
5198 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
|
5199 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
|
5200 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5201 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5202 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
|
5203 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5204 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
|
5205 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
|
5206 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5207 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5208 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5209 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5210 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
|
5211 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5212 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5213 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
|
5214 /* 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
|
5215 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5216 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5217 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5218 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5219 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5220 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
5221 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5222 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5223 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
|
5224 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
|
5225 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
|
5226 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5227 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5228 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
|
5229 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
|
5230 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
|
5231 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
5232 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
5233 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
5234 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
5235 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
5236 break; |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5237 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5238 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
|
5239 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5240 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5241 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5242 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5243 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
|
5244 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
|
5245 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5246 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5247 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5248 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
|
5249 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5250 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
|
5251 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
|
5252 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
|
5253 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
|
5254 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
|
5255 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5256 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
|
5257 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5258 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
|
5259 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5260 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5261 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5262 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5263 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5264 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5265 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
|
5266 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
|
5267 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5268 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5269 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5270 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
|
5271 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
|
5272 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5273 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5274 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5275 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5276 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5277 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5278 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5279 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5280 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5281 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5282 posx -= 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 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
|
5285 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5286 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5287 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
|
5288 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5289 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
|
5290 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
|
5291 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5292 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5293 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5294 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5295 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
|
5296 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5297 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5298 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
|
5299 /* 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
|
5300 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5301 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5302 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5303 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5304 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5305 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
5306 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5307 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5308 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
|
5309 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
|
5310 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
|
5311 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5312 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5313 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
|
5314 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
|
5315 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
|
5316 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
5317 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
5318 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
5319 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
5320 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
5321 break; |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5322 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5323 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
|
5324 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5325 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5326 ++dst; |
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 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5329 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
|
5330 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5331 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5332 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5333 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
|
5334 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5335 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
|
5336 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5337 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
|
5338 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5339 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5340 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5341 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5342 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5343 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5344 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
|
5345 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
|
5346 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5347 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5348 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5349 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
|
5350 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
|
5351 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5352 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5353 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5354 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5355 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5356 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5357 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5358 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5359 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5360 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5361 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5362 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5363 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
|
5364 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5365 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5366 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
|
5367 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
|
5368 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5369 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5370 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5371 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5372 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5373 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
|
5374 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5375 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5376 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5377 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
|
5378 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5379 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
|
5380 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5381 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
|
5382 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5383 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
|
5384 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5385 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5386 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
|
5387 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
|
5388 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
|
5389 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5390 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5391 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
|
5392 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5393 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
|
5394 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
|
5395 /* 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
|
5396 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5397 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5398 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5399 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5400 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5401 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
5402 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5403 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5404 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
|
5405 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
|
5406 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
|
5407 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5408 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5409 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
|
5410 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
|
5411 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
|
5412 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
5413 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
5414 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
5415 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
5416 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
5417 break; |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5418 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5419 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
|
5420 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5421 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5422 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5423 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5424 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
|
5425 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
|
5426 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5427 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5428 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5429 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
|
5430 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5431 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
|
5432 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5433 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
|
5434 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5435 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
|
5436 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5437 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5438 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5439 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5440 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5441 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5442 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
|
5443 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
|
5444 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5445 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5446 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5447 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
|
5448 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
|
5449 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5450 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5451 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5452 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5453 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5454 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5455 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5456 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5457 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5458 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5459 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5460 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5461 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
|
5462 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5463 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5464 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
|
5465 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5466 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
|
5467 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
|
5468 /* 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
|
5469 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5470 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5471 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5472 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5473 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5474 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
5475 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5476 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5477 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
|
5478 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
|
5479 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
|
5480 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5481 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5482 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
|
5483 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
|
5484 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
|
5485 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
5486 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
5487 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
5488 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
5489 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
5490 break; |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5491 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5492 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
|
5493 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5494 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5495 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5496 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5497 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5498 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
|
5499 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5500 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5501 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5502 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
|
5503 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5504 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
|
5505 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
|
5506 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
|
5507 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
|
5508 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
|
5509 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5510 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
|
5511 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5512 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5513 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
|
5514 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
|
5515 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
|
5516 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5517 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5518 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
|
5519 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
|
5520 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5521 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5522 B = (B * modulateB) / 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 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
|
5525 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5526 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5527 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
|
5528 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5529 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5530 ++dst; |
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 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
|
5533 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
|
5534 } |
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 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5537 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
|
5538 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5539 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
|
5540 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
|
5541 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
|
5542 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
|
5543 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
|
5544 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5545 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
|
5546 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5547 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5548 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5549 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5550 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5551 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5552 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
|
5553 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
|
5554 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5555 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5556 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5557 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
|
5558 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
|
5559 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5560 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5561 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5562 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5563 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5564 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5565 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5566 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5567 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5568 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5569 posx -= 0x10000L; |
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 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
|
5572 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5573 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5574 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
|
5575 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
|
5576 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5577 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5578 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5579 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5580 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
|
5581 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5582 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5583 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
|
5584 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5585 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5586 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5587 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5588 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5589 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
|
5590 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5591 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5592 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5593 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
|
5594 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5595 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
|
5596 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
|
5597 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
|
5598 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
|
5599 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
|
5600 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5601 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
|
5602 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5603 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
|
5604 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5605 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5606 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
|
5607 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
|
5608 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
|
5609 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5610 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5611 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
|
5612 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5613 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
|
5614 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
|
5615 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5616 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5617 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5618 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5619 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
|
5620 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5621 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5622 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
|
5623 /* 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
|
5624 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5625 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5626 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5627 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5628 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5629 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
5630 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5631 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5632 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
|
5633 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
|
5634 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
|
5635 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5636 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5637 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
|
5638 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
|
5639 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
|
5640 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
5641 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
5642 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
5643 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
5644 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
5645 break; |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5646 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5647 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
|
5648 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5649 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5650 ++dst; |
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 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
|
5653 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
|
5654 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5655 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5656 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5657 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
|
5658 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5659 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
|
5660 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
|
5661 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
|
5662 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
|
5663 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
|
5664 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5665 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
|
5666 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5667 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
|
5668 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5669 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5670 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5671 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5672 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5673 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5674 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
|
5675 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
|
5676 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5677 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5678 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5679 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
|
5680 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
|
5681 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5682 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5683 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5684 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5685 posy -= 0x10000L; |
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 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5688 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5689 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5690 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5691 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5692 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5693 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
|
5694 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5695 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5696 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
|
5697 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5698 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
|
5699 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
|
5700 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5701 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5702 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5703 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5704 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
|
5705 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5706 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5707 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
|
5708 /* 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
|
5709 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5710 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5711 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5712 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5713 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5714 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
5715 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5716 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5717 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
|
5718 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
|
5719 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
|
5720 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5721 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5722 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
|
5723 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
|
5724 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
|
5725 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
5726 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
5727 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
5728 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
5729 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
5730 break; |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5731 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5732 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
|
5733 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5734 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5735 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5736 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5737 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5738 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
|
5739 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5740 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5741 |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5742 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
|
5743 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5744 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5745 Uint32 pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5746 Uint32 R, G, B, A; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5747 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5748 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5749 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5750 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5751 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5752 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5753 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
|
5754 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
|
5755 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5756 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5757 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5758 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5759 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5760 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5761 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5762 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5763 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5764 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5765 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5766 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5767 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5768 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5769 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5770 posx -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5771 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5772 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
|
5773 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5774 pixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5775 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
|
5776 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
|
5777 *dst = pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5778 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5779 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5780 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5781 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5782 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5783 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5784 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5785 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5786 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
|
5787 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5788 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5789 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5790 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5791 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5792 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5793 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5794 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5795 Uint32 *src = (Uint32 *)info->src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5796 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5797 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5798 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5799 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5800 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
|
5801 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5802 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
|
5803 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
|
5804 /* 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
|
5805 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5806 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5807 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5808 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5809 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5810 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
5811 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5812 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5813 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
|
5814 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
|
5815 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
|
5816 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5817 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5818 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
|
5819 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
|
5820 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
|
5821 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
5822 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
5823 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
5824 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
5825 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
5826 break; |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5827 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5828 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
|
5829 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5830 ++src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5831 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5832 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5833 info->src += info->src_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5834 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5835 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5836 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5837 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5838 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
|
5839 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5840 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5841 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5842 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5843 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5844 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5845 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5846 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5847 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5848 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5849 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5850 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5851 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
|
5852 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
|
5853 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5854 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5855 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5856 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5857 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5858 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5859 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5860 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5861 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5862 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5863 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5864 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5865 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5866 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5867 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5868 posx -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5869 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5870 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
|
5871 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5872 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5873 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
|
5874 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5875 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
|
5876 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
|
5877 /* 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
|
5878 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5879 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5880 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5881 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5882 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5883 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
5884 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5885 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5886 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
|
5887 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
|
5888 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
|
5889 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5890 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5891 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
|
5892 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
|
5893 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
|
5894 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
5895 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
5896 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
5897 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
5898 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
5899 break; |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5900 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5901 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
|
5902 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5903 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5904 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5905 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5906 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5907 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5908 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5909 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5910 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5911 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
|
5912 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5913 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5914 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5915 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5916 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5917 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5918 Uint32 pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5919 Uint32 R, G, B, A; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5920 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5921 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5922 Uint32 *src = (Uint32 *)info->src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5923 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5924 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5925 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5926 pixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5927 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
|
5928 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
|
5929 R = (R * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5930 G = (G * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5931 B = (B * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5932 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5933 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
|
5934 A = (A * modulateA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5935 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5936 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
|
5937 *dst = pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5938 ++src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5939 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5940 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5941 info->src += info->src_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5942 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5943 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5944 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5945 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5946 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
|
5947 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5948 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5949 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5950 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5951 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5952 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5953 Uint32 pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5954 Uint32 R, G, B, A; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5955 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5956 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5957 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5958 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5959 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5960 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5961 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
|
5962 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
|
5963 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5964 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5965 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5966 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5967 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5968 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5969 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5970 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5971 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5972 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5973 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5974 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5975 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5976 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5977 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5978 posx -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5979 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5980 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
|
5981 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5982 pixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5983 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
|
5984 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
|
5985 R = (R * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5986 G = (G * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5987 B = (B * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5988 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5989 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
|
5990 A = (A * modulateA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5991 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5992 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
|
5993 *dst = pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5994 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5995 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5996 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5997 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5998 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5999 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6000 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6001 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6002 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
|
6003 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6004 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6005 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6006 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6007 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6008 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6009 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6010 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6011 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6012 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6013 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6014 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6015 Uint32 *src = (Uint32 *)info->src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6016 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6017 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6018 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6019 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6020 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
|
6021 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6022 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
|
6023 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
|
6024 srcR = (srcR * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6025 srcG = (srcG * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6026 srcB = (srcB * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6027 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6028 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
|
6029 srcA = (srcA * modulateA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6030 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6031 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
|
6032 /* 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
|
6033 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6034 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6035 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6036 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6037 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6038 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
6039 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6040 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6041 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
|
6042 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
|
6043 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
|
6044 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6045 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6046 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
|
6047 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
|
6048 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
|
6049 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
6050 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
6051 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
6052 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
6053 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
6054 break; |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6055 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6056 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
|
6057 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6058 ++src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6059 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6060 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6061 info->src += info->src_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6062 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6063 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6064 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6065 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6066 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
|
6067 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6068 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6069 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6070 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6071 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6072 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6073 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6074 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6075 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6076 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6077 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6078 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6079 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6080 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6081 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6082 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6083 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
|
6084 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
|
6085 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6086 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6087 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6088 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6089 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6090 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6091 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6092 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6093 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6094 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6095 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6096 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6097 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6098 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6099 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6100 posx -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6101 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6102 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
|
6103 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6104 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6105 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
|
6106 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6107 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
|
6108 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
|
6109 srcR = (srcR * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6110 srcG = (srcG * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6111 srcB = (srcB * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6112 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6113 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
|
6114 srcA = (srcA * modulateA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6115 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6116 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
|
6117 /* 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
|
6118 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6119 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6120 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6121 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6122 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6123 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
6124 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6125 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6126 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
|
6127 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
|
6128 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
|
6129 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6130 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6131 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
|
6132 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
|
6133 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
|
6134 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
6135 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
6136 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
6137 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
6138 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
6139 break; |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6140 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6141 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
|
6142 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6143 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6144 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6145 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6146 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6147 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6148 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6149 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6150 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
6151 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
|
6152 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6153 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
|
6154 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6155 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
|
6156 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6157 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6158 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6159 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6160 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6161 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6162 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
|
6163 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
|
6164 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6165 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6166 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6167 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
|
6168 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
|
6169 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6170 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6171 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6172 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6173 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6174 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6175 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6176 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6177 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6178 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6179 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6180 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6181 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
|
6182 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6183 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6184 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
|
6185 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
|
6186 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6187 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6188 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6189 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6190 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6191 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
|
6192 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6193 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6194 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
6195 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
|
6196 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6197 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
|
6198 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6199 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
|
6200 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6201 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
|
6202 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6203 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6204 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
|
6205 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
|
6206 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
|
6207 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6208 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6209 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
|
6210 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6211 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
|
6212 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
|
6213 /* 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
|
6214 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6215 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6216 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6217 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6218 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6219 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
6220 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6221 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6222 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
|
6223 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
|
6224 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
|
6225 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6226 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6227 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
|
6228 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
|
6229 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
|
6230 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
6231 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
6232 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
6233 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
6234 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
6235 break; |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6236 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6237 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
|
6238 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6239 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6240 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6241 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6242 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
|
6243 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
|
6244 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6245 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6246 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
6247 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
|
6248 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6249 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
|
6250 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6251 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
|
6252 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6253 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
|
6254 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6255 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6256 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6257 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6258 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6259 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6260 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
|
6261 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
|
6262 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6263 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6264 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6265 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
|
6266 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
|
6267 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6268 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6269 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6270 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6271 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6272 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6273 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6274 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6275 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6276 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6277 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6278 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6279 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
|
6280 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6281 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6282 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
|
6283 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6284 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
|
6285 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
|
6286 /* 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
|
6287 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6288 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6289 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6290 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6291 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6292 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
6293 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6294 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6295 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
|
6296 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
|
6297 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
|
6298 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6299 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6300 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
|
6301 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
|
6302 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
|
6303 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
6304 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
6305 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
6306 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
6307 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
6308 break; |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6309 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6310 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
|
6311 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6312 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6313 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6314 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6315 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6316 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
|
6317 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6318 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6319 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
6320 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
|
6321 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6322 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
|
6323 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
|
6324 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
|
6325 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
|
6326 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
|
6327 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6328 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
|
6329 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6330 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6331 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
|
6332 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
|
6333 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
|
6334 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6335 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6336 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
|
6337 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
|
6338 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6339 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6340 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6341 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6342 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
|
6343 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6344 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6345 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
|
6346 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6347 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6348 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6349 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6350 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
|
6351 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
|
6352 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6353 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6354 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
6355 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
|
6356 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6357 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
|
6358 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
|
6359 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
|
6360 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
|
6361 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
|
6362 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6363 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
|
6364 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6365 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6366 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6367 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6368 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6369 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6370 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
|
6371 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
|
6372 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6373 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6374 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6375 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
|
6376 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
|
6377 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6378 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6379 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6380 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6381 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6382 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6383 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6384 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6385 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6386 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6387 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6388 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6389 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
|
6390 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6391 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6392 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
|
6393 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
|
6394 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6395 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6396 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6397 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6398 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
|
6399 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6400 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6401 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
|
6402 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6403 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6404 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6405 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6406 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6407 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
|
6408 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6409 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6410 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
6411 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
|
6412 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6413 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
|
6414 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
|
6415 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
|
6416 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
|
6417 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
|
6418 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6419 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
|
6420 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6421 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
|
6422 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6423 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6424 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
|
6425 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
|
6426 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
|
6427 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6428 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6429 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
|
6430 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6431 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
|
6432 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
|
6433 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6434 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6435 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6436 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6437 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
|
6438 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6439 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6440 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
|
6441 /* 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
|
6442 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6443 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6444 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6445 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6446 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6447 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
6448 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6449 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6450 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
|
6451 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
|
6452 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
|
6453 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6454 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6455 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
|
6456 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
|
6457 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
|
6458 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
6459 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
6460 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
6461 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
6462 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
6463 break; |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6464 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6465 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
|
6466 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6467 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6468 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6469 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6470 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
|
6471 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
|
6472 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6473 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6474 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
6475 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
|
6476 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6477 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
|
6478 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
|
6479 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
|
6480 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
|
6481 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
|
6482 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6483 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
|
6484 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6485 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
|
6486 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6487 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6488 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6489 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6490 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6491 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6492 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
|
6493 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
|
6494 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6495 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6496 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6497 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
|
6498 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
|
6499 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6500 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6501 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6502 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6503 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6504 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6505 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6506 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6507 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6508 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6509 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6510 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6511 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
|
6512 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6513 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6514 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
|
6515 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6516 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
|
6517 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
|
6518 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6519 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6520 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6521 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6522 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
|
6523 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6524 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6525 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
|
6526 /* 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
|
6527 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6528 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6529 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6530 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6531 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6532 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
6533 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6534 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6535 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
|
6536 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
|
6537 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
|
6538 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6539 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6540 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
|
6541 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
|
6542 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
|
6543 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
6544 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
6545 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
6546 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
6547 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
6548 break; |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6549 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6550 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
|
6551 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6552 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6553 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6554 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6555 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6556 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
|
6557 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6558 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6559 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
6560 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
|
6561 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6562 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
|
6563 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6564 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
|
6565 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6566 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6567 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6568 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6569 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6570 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6571 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
|
6572 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
|
6573 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6574 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6575 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6576 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
|
6577 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
|
6578 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6579 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6580 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6581 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6582 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6583 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6584 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6585 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6586 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6587 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6588 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6589 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6590 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
|
6591 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6592 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6593 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
|
6594 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
|
6595 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6596 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6597 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6598 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6599 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6600 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
|
6601 } |
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 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
6604 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
|
6605 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6606 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
|
6607 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6608 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
|
6609 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6610 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
|
6611 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6612 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6613 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
|
6614 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
|
6615 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
|
6616 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6617 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6618 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
|
6619 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6620 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
|
6621 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
|
6622 /* 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
|
6623 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6624 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6625 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6626 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6627 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6628 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
6629 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6630 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6631 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
|
6632 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
|
6633 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
|
6634 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6635 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6636 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
|
6637 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
|
6638 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
|
6639 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
6640 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
6641 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
6642 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
6643 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
6644 break; |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6645 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6646 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
|
6647 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6648 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6649 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6650 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6651 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
|
6652 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
|
6653 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6654 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6655 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
6656 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
|
6657 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6658 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
|
6659 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6660 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
|
6661 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6662 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
|
6663 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6664 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6665 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6666 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6667 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6668 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6669 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
|
6670 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
|
6671 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6672 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6673 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6674 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
|
6675 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
|
6676 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6677 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6678 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6679 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6680 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6681 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6682 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6683 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6684 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6685 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6686 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6687 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6688 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
|
6689 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6690 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6691 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
|
6692 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6693 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
|
6694 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
|
6695 /* 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
|
6696 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6697 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6698 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6699 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6700 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6701 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
6702 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6703 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6704 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
|
6705 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
|
6706 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
|
6707 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6708 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6709 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
|
6710 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
|
6711 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
|
6712 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
6713 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
6714 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
6715 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
6716 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
6717 break; |
2262
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 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
|
6720 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6721 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6722 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6723 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6724 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6725 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
|
6726 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6727 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6728 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
6729 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
|
6730 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6731 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
|
6732 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
|
6733 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
|
6734 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
|
6735 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
|
6736 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6737 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
|
6738 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6739 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6740 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
|
6741 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
|
6742 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
|
6743 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6744 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6745 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
|
6746 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
|
6747 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6748 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6749 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6750 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6751 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
|
6752 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6753 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6754 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
|
6755 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6756 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6757 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6758 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6759 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
|
6760 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
|
6761 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6762 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6763 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
6764 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
|
6765 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6766 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
|
6767 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
|
6768 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
|
6769 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
|
6770 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
|
6771 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6772 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
|
6773 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6774 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6775 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6776 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6777 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6778 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6779 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
|
6780 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
|
6781 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6782 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6783 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6784 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
|
6785 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
|
6786 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6787 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6788 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6789 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6790 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6791 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6792 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6793 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6794 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6795 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6796 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6797 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6798 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
|
6799 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6800 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6801 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
|
6802 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
|
6803 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6804 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6805 B = (B * modulateB) / 255; |
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 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
|
6808 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6809 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6810 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
|
6811 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6812 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6813 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6814 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6815 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6816 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
|
6817 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6818 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6819 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
6820 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
|
6821 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6822 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
|
6823 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
|
6824 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
|
6825 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
|
6826 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
|
6827 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6828 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
|
6829 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6830 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
|
6831 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6832 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6833 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
|
6834 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
|
6835 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
|
6836 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6837 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6838 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
|
6839 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6840 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
|
6841 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
|
6842 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6843 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6844 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6845 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6846 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
|
6847 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6848 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6849 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
|
6850 /* 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
|
6851 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6852 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6853 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6854 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6855 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6856 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
6857 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6858 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6859 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
|
6860 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
|
6861 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
|
6862 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6863 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6864 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
|
6865 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
|
6866 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
|
6867 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
6868 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
6869 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
6870 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
6871 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
6872 break; |
2262
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 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
|
6875 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6876 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6877 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6878 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6879 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
|
6880 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
|
6881 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6882 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6883 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
6884 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
|
6885 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6886 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
|
6887 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
|
6888 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
|
6889 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
|
6890 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
|
6891 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6892 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
|
6893 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6894 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
|
6895 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6896 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6897 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6898 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6899 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6900 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6901 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
|
6902 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
|
6903 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6904 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6905 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6906 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
|
6907 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
|
6908 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6909 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6910 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6911 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6912 posy -= 0x10000L; |
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 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6915 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6916 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6917 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6918 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6919 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6920 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
|
6921 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6922 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6923 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
|
6924 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6925 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
|
6926 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
|
6927 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6928 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6929 srcB = (srcB * modulateB) / 255; |
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 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
|
6932 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6933 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6934 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
|
6935 /* 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
|
6936 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6937 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6938 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6939 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6940 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6941 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
6942 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6943 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6944 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
|
6945 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
|
6946 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
|
6947 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6948 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6949 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
|
6950 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
|
6951 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
|
6952 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
6953 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
6954 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
6955 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
6956 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
6957 break; |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6958 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6959 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
|
6960 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6961 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6962 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6963 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6964 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6965 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
|
6966 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6967 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6968 |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6969 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
|
6970 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6971 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6972 Uint32 pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6973 Uint32 R, G, B, A; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6974 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6975 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6976 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6977 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6978 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6979 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6980 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
|
6981 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
|
6982 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6983 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6984 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6985 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6986 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6987 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6988 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6989 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6990 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6991 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6992 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6993 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6994 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6995 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6996 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6997 posx -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6998 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6999 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
|
7000 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7001 pixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7002 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
|
7003 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
|
7004 *dst = pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7005 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7006 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7007 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7008 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7009 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7010 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7011 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7012 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7013 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
|
7014 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7015 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7016 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7017 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7018 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7019 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7020 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7021 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7022 Uint32 *src = (Uint32 *)info->src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7023 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7024 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7025 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7026 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7027 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
|
7028 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7029 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
|
7030 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
|
7031 /* 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
|
7032 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7033 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7034 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7035 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7036 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7037 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7038 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7039 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7040 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
|
7041 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
|
7042 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
|
7043 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7044 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7045 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
|
7046 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
|
7047 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
|
7048 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7049 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7050 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7051 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7052 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7053 break; |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7054 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7055 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
|
7056 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7057 ++src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7058 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7059 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7060 info->src += info->src_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7061 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7062 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7063 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7064 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7065 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
|
7066 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7067 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7068 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7069 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7070 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7071 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7072 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7073 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7074 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7075 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7076 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7077 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7078 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
|
7079 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
|
7080 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7081 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7082 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7083 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7084 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7085 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7086 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7087 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7088 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7089 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7090 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7091 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7092 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7093 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7094 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7095 posx -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7096 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7097 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
|
7098 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7099 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7100 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
|
7101 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7102 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
|
7103 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
|
7104 /* 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
|
7105 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7106 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7107 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7108 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7109 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7110 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7111 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7112 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7113 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
|
7114 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
|
7115 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
|
7116 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7117 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7118 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
|
7119 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
|
7120 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
|
7121 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7122 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7123 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7124 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7125 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7126 break; |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7127 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7128 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
|
7129 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7130 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7131 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7132 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7133 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7134 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7135 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7136 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7137 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7138 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
|
7139 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7140 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7141 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7142 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7143 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7144 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7145 Uint32 pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7146 Uint32 R, G, B, A; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7147 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7148 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7149 Uint32 *src = (Uint32 *)info->src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7150 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7151 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7152 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7153 pixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7154 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
|
7155 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
|
7156 R = (R * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7157 G = (G * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7158 B = (B * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7159 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7160 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
|
7161 A = (A * modulateA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7162 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7163 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
|
7164 *dst = pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7165 ++src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7166 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7167 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7168 info->src += info->src_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7169 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7170 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7171 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7172 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7173 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
|
7174 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7175 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7176 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7177 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7178 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7179 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7180 Uint32 pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7181 Uint32 R, G, B, A; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7182 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7183 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7184 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7185 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7186 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7187 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7188 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
|
7189 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
|
7190 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7191 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7192 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7193 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7194 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7195 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7196 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7197 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7198 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7199 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7200 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7201 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7202 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7203 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7204 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7205 posx -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7206 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7207 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
|
7208 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7209 pixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7210 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
|
7211 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
|
7212 R = (R * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7213 G = (G * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7214 B = (B * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7215 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7216 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
|
7217 A = (A * modulateA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7218 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7219 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
|
7220 *dst = pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7221 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7222 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7223 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7224 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7225 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7226 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7227 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7228 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7229 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
|
7230 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7231 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7232 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7233 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7234 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7235 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7236 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7237 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7238 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7239 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7240 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7241 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7242 Uint32 *src = (Uint32 *)info->src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7243 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7244 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7245 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7246 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7247 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
|
7248 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7249 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
|
7250 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
|
7251 srcR = (srcR * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7252 srcG = (srcG * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7253 srcB = (srcB * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7254 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7255 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
|
7256 srcA = (srcA * modulateA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7257 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7258 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
|
7259 /* 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
|
7260 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7261 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7262 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7263 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7264 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7265 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7266 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7267 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7268 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
|
7269 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
|
7270 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
|
7271 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7272 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7273 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
|
7274 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
|
7275 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
|
7276 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7277 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7278 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7279 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7280 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7281 break; |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7282 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7283 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
|
7284 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7285 ++src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7286 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7287 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7288 info->src += info->src_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7289 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7290 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7291 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7292 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7293 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
|
7294 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7295 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7296 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7297 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7298 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7299 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7300 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7301 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7302 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7303 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7304 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7305 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7306 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7307 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7308 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7309 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7310 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
|
7311 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
|
7312 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7313 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7314 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7315 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7316 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7317 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7318 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7319 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7320 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7321 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7322 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7323 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7324 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7325 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7326 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7327 posx -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7328 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7329 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
|
7330 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7331 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7332 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
|
7333 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7334 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
|
7335 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
|
7336 srcR = (srcR * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7337 srcG = (srcG * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7338 srcB = (srcB * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7339 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7340 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
|
7341 srcA = (srcA * modulateA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7342 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7343 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
|
7344 /* 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
|
7345 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7346 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7347 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7348 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7349 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7350 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7351 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7352 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7353 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
|
7354 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
|
7355 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
|
7356 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7357 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7358 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
|
7359 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
|
7360 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
|
7361 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7362 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7363 dstR = (srcR * dstR) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7364 dstG = (srcG * dstG) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7365 dstB = (srcB * dstB) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7366 break; |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7367 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7368 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
|
7369 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7370 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7371 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7372 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7373 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7374 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7375 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7376 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7377 |
2267
c785543d1843
Okay, still some bugs, but everything builds again...
Sam Lantinga <slouken@libsdl.org>
parents:
2263
diff
changeset
|
7378 SDL_BlitFuncEntry SDL_GeneratedBlitFuncTable[] = { |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7379 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_RGB888_Scale }, |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7380 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGB888_RGB888_Blend }, |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7381 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_RGB888_Blend_Scale }, |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7382 { 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
|
7383 { 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 }, |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7384 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGB888_RGB888_Modulate_Blend }, |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7385 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_RGB888_Modulate_Blend_Scale }, |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7386 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_BGR888_Scale }, |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7387 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGB888_BGR888_Blend }, |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7388 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_BGR888_Blend_Scale }, |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7389 { 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
|
7390 { 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 }, |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7391 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGB888_BGR888_Modulate_Blend }, |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7392 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_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
|
7393 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_ARGB8888_Scale }, |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7394 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGB888_ARGB8888_Blend }, |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7395 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_ARGB8888_Blend_Scale }, |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7396 { 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
|
7397 { 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 }, |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7398 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGB888_ARGB8888_Modulate_Blend }, |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7399 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_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
|
7400 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Scale }, |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7401 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Blend }, |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7402 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Blend_Scale }, |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7403 { 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
|
7404 { 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 }, |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7405 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Modulate_Blend }, |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7406 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Modulate_Blend_Scale }, |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7407 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_BGR888_Scale }, |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7408 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGR888_BGR888_Blend }, |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7409 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_BGR888_Blend_Scale }, |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7410 { 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
|
7411 { 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 }, |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7412 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGR888_BGR888_Modulate_Blend }, |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7413 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_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
|
7414 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_ARGB8888_Scale }, |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7415 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGR888_ARGB8888_Blend }, |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7416 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_ARGB8888_Blend_Scale }, |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7417 { 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
|
7418 { 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 }, |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7419 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGR888_ARGB8888_Modulate_Blend }, |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7420 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_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
|
7421 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Scale }, |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7422 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Blend }, |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7423 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Blend_Scale }, |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7424 { 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
|
7425 { 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 }, |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7426 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Modulate_Blend }, |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7427 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Modulate_Blend_Scale }, |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7428 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_BGR888_Scale }, |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7429 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ARGB8888_BGR888_Blend }, |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7430 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_BGR888_Blend_Scale }, |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7431 { 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
|
7432 { 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 }, |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7433 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ARGB8888_BGR888_Modulate_Blend }, |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7434 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_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
|
7435 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_ARGB8888_Scale }, |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7436 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ARGB8888_ARGB8888_Blend }, |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7437 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_ARGB8888_Blend_Scale }, |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7438 { 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
|
7439 { 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 }, |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7440 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ARGB8888_ARGB8888_Modulate_Blend }, |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7441 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_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
|
7442 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Scale }, |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7443 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Blend }, |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7444 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Blend_Scale }, |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7445 { 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
|
7446 { 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 }, |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7447 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Modulate_Blend }, |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7448 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Modulate_Blend_Scale }, |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7449 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_BGR888_Scale }, |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7450 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGBA8888_BGR888_Blend }, |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7451 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_BGR888_Blend_Scale }, |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7452 { 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
|
7453 { 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 }, |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7454 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGBA8888_BGR888_Modulate_Blend }, |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7455 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_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
|
7456 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_ARGB8888_Scale }, |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7457 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGBA8888_ARGB8888_Blend }, |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7458 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_ARGB8888_Blend_Scale }, |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7459 { 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
|
7460 { 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 }, |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7461 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGBA8888_ARGB8888_Modulate_Blend }, |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7462 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_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
|
7463 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Scale }, |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7464 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Blend }, |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7465 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Blend_Scale }, |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7466 { 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
|
7467 { 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 }, |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7468 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Modulate_Blend }, |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7469 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Modulate_Blend_Scale }, |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7470 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_BGR888_Scale }, |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7471 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ABGR8888_BGR888_Blend }, |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7472 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_BGR888_Blend_Scale }, |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7473 { 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
|
7474 { 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 }, |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7475 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ABGR8888_BGR888_Modulate_Blend }, |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7476 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_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
|
7477 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_ARGB8888_Scale }, |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7478 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ABGR8888_ARGB8888_Blend }, |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7479 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_ARGB8888_Blend_Scale }, |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7480 { 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
|
7481 { 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 }, |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7482 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ABGR8888_ARGB8888_Modulate_Blend }, |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7483 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_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
|
7484 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Scale }, |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7485 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Blend }, |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7486 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Blend_Scale }, |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7487 { 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
|
7488 { 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 }, |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7489 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Modulate_Blend }, |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7490 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Modulate_Blend_Scale }, |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7491 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_BGR888_Scale }, |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7492 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGRA8888_BGR888_Blend }, |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7493 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_BGR888_Blend_Scale }, |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7494 { 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
|
7495 { 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 }, |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7496 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGRA8888_BGR888_Modulate_Blend }, |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7497 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_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
|
7498 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_ARGB8888_Scale }, |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7499 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGRA8888_ARGB8888_Blend }, |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7500 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_ARGB8888_Blend_Scale }, |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7501 { 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
|
7502 { 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 }, |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7503 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGRA8888_ARGB8888_Modulate_Blend }, |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5143
diff
changeset
|
7504 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_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
|
7505 { 0, 0, 0, 0, NULL } |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7506 }; |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7507 |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7508 /* *INDENT-ON* */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7509 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7510 /* vi: set ts=4 sw=4 expandtab: */ |