Mercurial > sdl-ios-xcode
annotate src/video/SDL_blit_auto.c @ 5168:2b1989f59674
Extended SDL_SetWindowData() to allow arbitrary named values.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Thu, 03 Feb 2011 11:16:57 -0800 |
parents | e743b9c3f6d6 |
children | d976b67150c5 |
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 } |
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
|
95 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
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; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
106 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
107 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
|
108 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
109 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
110 ++dst; |
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 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
|
113 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
|
114 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
115 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
116 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
117 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
|
118 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
119 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
|
120 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
121 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
|
122 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
123 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
|
124 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
125 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
126 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
127 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
128 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
129 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
130 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
|
131 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
|
132 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
133 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
134 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
135 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
|
136 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
|
137 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
138 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
139 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
140 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
141 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
142 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
143 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
144 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
145 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
146 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
147 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
148 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
149 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
|
150 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
151 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
152 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
|
153 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
154 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
|
155 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
|
156 /* 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
|
157 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
158 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
159 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
160 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
161 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
162 } |
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
|
163 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
164 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
165 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
|
166 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
|
167 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
|
168 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
169 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
170 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
|
171 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
|
172 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
|
173 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
174 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
175 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
|
176 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
177 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
178 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
179 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
180 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
181 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
|
182 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
183 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
184 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
185 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
|
186 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
187 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
|
188 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
|
189 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
|
190 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
|
191 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
|
192 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
193 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
|
194 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
195 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
196 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
|
197 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
|
198 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
|
199 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
200 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
201 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
|
202 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
|
203 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
204 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
205 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
206 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
207 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
|
208 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
209 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
210 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
|
211 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
212 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
213 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
214 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
215 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
|
216 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
|
217 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
218 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
219 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
220 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
|
221 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
222 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
|
223 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
|
224 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
|
225 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
|
226 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
|
227 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
228 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
|
229 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
230 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
231 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
232 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
233 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
234 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
235 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
|
236 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
|
237 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
238 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
239 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
240 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
|
241 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
|
242 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
243 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
244 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
245 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
246 posy -= 0x10000L; |
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 (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
249 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
250 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
251 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
252 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
253 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
254 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
|
255 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
256 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
257 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
|
258 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
|
259 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
260 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
261 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
262 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
263 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
|
264 A = (A * modulateA) / 255; |
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 = ((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
|
267 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
268 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
269 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
270 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
271 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
272 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
|
273 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
274 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
275 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
276 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
|
277 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
278 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
|
279 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
|
280 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
|
281 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
|
282 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
|
283 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
284 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
|
285 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
286 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
|
287 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
288 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
289 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
|
290 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
|
291 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
|
292 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
293 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
294 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
|
295 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
296 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
|
297 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
|
298 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
299 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
300 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
301 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
302 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
|
303 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
304 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
305 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
|
306 /* 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
|
307 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
308 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
309 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
310 srcB = (srcB * srcA) / 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 } |
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
|
313 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
314 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
315 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
|
316 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
|
317 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
|
318 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
319 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
320 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
|
321 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
|
322 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
|
323 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
324 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
325 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
|
326 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
327 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
328 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
329 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
330 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
|
331 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
|
332 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
333 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
334 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
335 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
|
336 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
337 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
|
338 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
|
339 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
|
340 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
|
341 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
|
342 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
343 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
|
344 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
345 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
|
346 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
347 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
348 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
349 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
350 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
351 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
352 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
|
353 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
|
354 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
355 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
356 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
357 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
|
358 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
|
359 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
360 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
361 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
362 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
363 posy -= 0x10000L; |
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 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
366 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
367 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
368 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
369 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
370 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
371 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
|
372 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
373 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
374 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
|
375 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
376 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
|
377 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
|
378 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
379 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
380 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
381 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
382 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
|
383 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
384 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
385 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
|
386 /* 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
|
387 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
388 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
389 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
390 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
391 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
392 } |
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
|
393 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
394 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
395 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
|
396 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
|
397 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
|
398 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
399 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
400 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
|
401 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
|
402 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
|
403 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
404 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
405 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
|
406 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
407 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
408 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
409 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
410 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
411 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
|
412 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
413 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
414 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
415 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
|
416 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
417 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
|
418 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
419 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
|
420 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
421 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
422 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
423 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
424 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
425 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
426 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
|
427 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
|
428 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
429 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
430 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
431 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
|
432 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
|
433 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
434 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
435 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
436 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
437 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
438 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
439 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
440 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
441 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
442 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
443 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
444 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
445 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
|
446 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
447 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
448 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
|
449 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
|
450 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
451 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
452 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
453 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
454 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
455 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
|
456 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
457 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
458 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
459 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
|
460 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
461 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
|
462 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
463 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
|
464 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
465 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
|
466 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
467 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
468 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
|
469 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
|
470 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
|
471 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
472 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
473 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
|
474 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
475 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
|
476 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
|
477 /* 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
|
478 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
479 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
480 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
481 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
482 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
483 } |
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
|
484 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
485 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
486 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
|
487 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
|
488 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
|
489 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
490 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
491 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
|
492 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
|
493 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
|
494 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
495 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
496 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
|
497 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
498 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
499 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
500 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
501 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
|
502 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
|
503 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
504 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
505 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
506 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
|
507 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
508 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
|
509 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
510 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
|
511 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
512 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
|
513 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
514 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
515 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
516 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
517 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
518 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
519 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
|
520 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
|
521 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
522 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
523 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
524 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
|
525 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
|
526 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
527 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
528 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
529 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
530 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
531 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
532 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
533 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
534 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
535 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
536 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
537 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
538 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
|
539 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
540 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
541 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
|
542 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
543 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
|
544 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
|
545 /* 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
|
546 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
547 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
548 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
549 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
550 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
551 } |
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
|
552 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
553 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
554 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
|
555 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
|
556 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
|
557 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
558 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
559 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
|
560 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
|
561 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
|
562 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
563 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
564 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
|
565 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
566 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
567 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
568 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
569 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
570 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
|
571 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
572 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
573 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
574 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
|
575 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
576 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
|
577 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
|
578 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
|
579 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
|
580 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
|
581 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
582 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
|
583 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
584 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
585 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
|
586 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
|
587 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
|
588 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
589 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
590 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
|
591 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
|
592 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
593 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
594 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
595 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
596 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
|
597 A = (A * modulateA) / 255; |
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 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
|
600 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
601 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
602 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
603 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
604 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
|
605 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
|
606 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
607 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
608 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
609 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
|
610 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
611 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
|
612 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
|
613 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
|
614 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
|
615 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
|
616 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
617 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
|
618 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
619 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
620 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
621 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
622 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
623 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
624 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
|
625 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
|
626 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
627 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
628 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
629 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
|
630 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
|
631 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
632 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
633 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
634 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
635 posy -= 0x10000L; |
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 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
638 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
639 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
640 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
641 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
642 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
643 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
|
644 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
645 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
646 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
|
647 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
|
648 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
649 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
650 B = (B * modulateB) / 255; |
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 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
|
653 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
654 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
655 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
|
656 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
657 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
658 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
659 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
660 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
661 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
|
662 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
663 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
664 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
665 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
|
666 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
667 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
|
668 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
|
669 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
|
670 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
|
671 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
|
672 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
673 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
|
674 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
675 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
|
676 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
677 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
678 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
|
679 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
|
680 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
|
681 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
682 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
683 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
|
684 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
685 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
|
686 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
|
687 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
688 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
689 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
690 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
691 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
|
692 srcA = (srcA * modulateA) / 255; |
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 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
|
695 /* 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
|
696 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
697 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
698 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
699 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
700 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
701 } |
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
|
702 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
703 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
704 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
|
705 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
|
706 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
|
707 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
708 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
709 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
|
710 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
|
711 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
|
712 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
713 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
714 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
|
715 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
716 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
717 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
718 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
719 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
|
720 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
|
721 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
722 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
723 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
724 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
|
725 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
726 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
|
727 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
|
728 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
|
729 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
|
730 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
|
731 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
732 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
|
733 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
734 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
|
735 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
736 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
737 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
738 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
739 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
740 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
741 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
|
742 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
|
743 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
744 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
745 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
746 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
|
747 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
|
748 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
749 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
750 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
751 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
752 posy -= 0x10000L; |
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 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
755 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
756 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
757 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
758 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
759 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
760 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
|
761 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
762 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
763 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
|
764 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
765 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
|
766 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
|
767 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
768 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
769 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
770 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
771 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
|
772 srcA = (srcA * modulateA) / 255; |
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 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
|
775 /* 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
|
776 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
777 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
778 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
779 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
780 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
781 } |
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
|
782 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
783 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
784 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
|
785 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
|
786 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
|
787 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
788 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
789 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
|
790 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
|
791 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
|
792 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
793 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
794 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
|
795 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
796 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
797 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
798 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
799 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
800 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
|
801 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
802 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
803 |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
804 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
|
805 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
806 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
807 Uint32 pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
808 Uint32 R, G, B, A; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
809 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
810 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
811 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
812 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
813 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
814 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
815 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
|
816 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
|
817 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
818 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
819 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
820 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
821 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
822 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
823 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
824 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
825 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
826 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
827 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
828 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
829 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
830 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
831 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
832 posx -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
833 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
834 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
|
835 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
836 pixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
837 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
|
838 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
|
839 *dst = pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
840 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
841 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
842 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
843 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
844 info->dst += info->dst_pitch; |
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 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
847 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
848 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
|
849 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
850 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
851 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
852 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
853 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
854 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
855 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
856 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
857 Uint32 *src = (Uint32 *)info->src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
858 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
859 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
860 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
861 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
862 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
|
863 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
864 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
|
865 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
|
866 /* 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
|
867 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
868 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
869 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
870 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
871 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
872 } |
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
|
873 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
874 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
875 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
|
876 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
|
877 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
|
878 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
879 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
880 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
|
881 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
|
882 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
|
883 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
884 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
885 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
|
886 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
887 ++src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
888 ++dst; |
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 info->src += info->src_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
891 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
892 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
893 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
894 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
895 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
|
896 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
897 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
898 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
899 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
900 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
901 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
902 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
903 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
904 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
905 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
906 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
907 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
908 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
|
909 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
|
910 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
911 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
912 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
913 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
914 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
915 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
916 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
917 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
918 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
919 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
920 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
921 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
922 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
923 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
924 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
925 posx -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
926 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
927 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
|
928 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
929 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
930 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
|
931 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
932 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
|
933 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
|
934 /* 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
|
935 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
936 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
937 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
938 srcB = (srcB * srcA) / 255; |
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 } |
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
|
941 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
942 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
943 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
|
944 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
|
945 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
|
946 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
947 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
948 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
|
949 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
|
950 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
|
951 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
952 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
953 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
|
954 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
955 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
956 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
957 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
958 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
959 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
960 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
961 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
962 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
963 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
|
964 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
965 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
966 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
967 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
968 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
969 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
970 Uint32 pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
971 Uint32 R, G, B, A; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
972 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
973 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
974 Uint32 *src = (Uint32 *)info->src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
975 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
976 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
977 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
978 pixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
979 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
|
980 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
|
981 R = (R * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
982 G = (G * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
983 B = (B * modulateB) / 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 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
|
986 A = (A * modulateA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
987 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
988 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
|
989 *dst = pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
990 ++src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
991 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
992 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
993 info->src += info->src_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
994 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
995 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
996 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
997 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
998 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
|
999 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1000 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1001 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1002 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1003 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1004 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1005 Uint32 pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1006 Uint32 R, G, B, A; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1007 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1008 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1009 int incy, incx; |
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 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1012 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1013 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
|
1014 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
|
1015 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1016 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1017 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1018 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1019 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1020 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1021 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1022 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1023 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1024 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1025 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1026 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1027 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1028 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1029 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1030 posx -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1031 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1032 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
|
1033 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1034 pixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1035 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
|
1036 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
|
1037 R = (R * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1038 G = (G * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1039 B = (B * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1040 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1041 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
|
1042 A = (A * modulateA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1043 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1044 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
|
1045 *dst = pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1046 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1047 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1048 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1049 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1050 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1051 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1052 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1053 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1054 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
|
1055 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1056 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1057 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1058 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1059 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1060 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1061 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1062 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1063 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1064 Uint32 dstR, dstG, dstB, dstA; |
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 = (Uint32 *)info->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 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1071 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1072 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
|
1073 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1074 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
|
1075 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
|
1076 srcR = (srcR * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1077 srcG = (srcG * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1078 srcB = (srcB * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1079 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1080 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
|
1081 srcA = (srcA * modulateA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1082 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1083 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
|
1084 /* 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
|
1085 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1086 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1087 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1088 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1089 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1090 } |
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
|
1091 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1092 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1093 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
|
1094 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
|
1095 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
|
1096 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1097 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1098 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
|
1099 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
|
1100 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
|
1101 break; |
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 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
|
1104 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1105 ++src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1106 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1107 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1108 info->src += info->src_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1109 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1110 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1111 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1112 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1113 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
|
1114 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1115 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1116 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1117 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1118 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1119 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1120 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1121 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1122 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1123 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1124 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1125 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1126 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1127 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1128 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1129 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1130 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
|
1131 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
|
1132 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1133 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1134 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1135 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1136 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1137 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1138 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1139 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1140 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1141 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1142 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1143 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1144 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1145 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1146 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1147 posx -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1148 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1149 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
|
1150 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1151 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1152 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
|
1153 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1154 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
|
1155 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
|
1156 srcR = (srcR * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1157 srcG = (srcG * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1158 srcB = (srcB * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1159 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1160 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
|
1161 srcA = (srcA * modulateA) / 255; |
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 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
|
1164 /* 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
|
1165 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1166 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1167 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1168 srcB = (srcB * srcA) / 255; |
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 } |
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
|
1171 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1172 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1173 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
|
1174 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
|
1175 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
|
1176 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1177 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1178 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
|
1179 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
|
1180 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
|
1181 break; |
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 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
|
1184 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1185 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1186 ++dst; |
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 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1189 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1190 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1191 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1192 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
1193 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
|
1194 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1195 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
|
1196 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1197 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
|
1198 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1199 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1200 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1201 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1202 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1203 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1204 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
|
1205 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
|
1206 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1207 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1208 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1209 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
|
1210 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
|
1211 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1212 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1213 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1214 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1215 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1216 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1217 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1218 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1219 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1220 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1221 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1222 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1223 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
|
1224 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1225 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1226 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
|
1227 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
|
1228 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1229 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1230 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1231 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1232 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1233 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
|
1234 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1235 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1236 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
1237 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
|
1238 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1239 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
|
1240 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1241 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
|
1242 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1243 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
|
1244 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1245 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1246 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
|
1247 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
|
1248 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
|
1249 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1250 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1251 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
|
1252 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1253 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
|
1254 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
|
1255 /* 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
|
1256 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1257 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1258 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1259 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1260 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1261 } |
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
|
1262 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1263 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1264 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
|
1265 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
|
1266 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
|
1267 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1268 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1269 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
|
1270 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
|
1271 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
|
1272 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1273 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1274 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
|
1275 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1276 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1277 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1278 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1279 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
|
1280 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
|
1281 } |
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 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
1284 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
|
1285 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1286 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
|
1287 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1288 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
|
1289 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1290 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
|
1291 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1292 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1293 int incy, incx; |
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 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1296 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1297 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
|
1298 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
|
1299 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1300 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1301 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1302 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
|
1303 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
|
1304 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1305 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1306 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1307 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1308 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1309 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1310 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1311 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1312 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1313 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1314 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1315 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1316 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
|
1317 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1318 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1319 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
|
1320 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1321 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
|
1322 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
|
1323 /* 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
|
1324 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1325 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1326 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1327 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1328 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1329 } |
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
|
1330 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1331 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1332 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
|
1333 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
|
1334 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
|
1335 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1336 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1337 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
|
1338 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
|
1339 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
|
1340 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1341 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1342 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
|
1343 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1344 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1345 ++dst; |
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 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1348 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
|
1349 } |
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 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
1352 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
|
1353 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1354 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
|
1355 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
|
1356 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
|
1357 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
|
1358 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
|
1359 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1360 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
|
1361 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1362 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1363 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
|
1364 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
|
1365 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
|
1366 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1367 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1368 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
|
1369 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
|
1370 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1371 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1372 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1373 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1374 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
|
1375 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1376 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1377 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
|
1378 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1379 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1380 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1381 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1382 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
|
1383 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
|
1384 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1385 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1386 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
1387 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
|
1388 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1389 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
|
1390 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
|
1391 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
|
1392 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
|
1393 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
|
1394 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1395 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
|
1396 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1397 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1398 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1399 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1400 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1401 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1402 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
|
1403 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
|
1404 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1405 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1406 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1407 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
|
1408 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
|
1409 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1410 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1411 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1412 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1413 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1414 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1415 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1416 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1417 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1418 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1419 posx -= 0x10000L; |
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 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
|
1422 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1423 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1424 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
|
1425 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
|
1426 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1427 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1428 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1429 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1430 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
|
1431 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1432 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1433 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
|
1434 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1435 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1436 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1437 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1438 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1439 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
|
1440 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1441 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1442 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
1443 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
|
1444 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1445 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
|
1446 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
|
1447 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
|
1448 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
|
1449 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
|
1450 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1451 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
|
1452 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1453 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
|
1454 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1455 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1456 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
|
1457 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
|
1458 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
|
1459 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1460 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1461 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
|
1462 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1463 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
|
1464 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
|
1465 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1466 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1467 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1468 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1469 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
|
1470 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1471 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1472 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
|
1473 /* 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
|
1474 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1475 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1476 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1477 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1478 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1479 } |
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
|
1480 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1481 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1482 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
|
1483 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
|
1484 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
|
1485 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1486 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1487 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
|
1488 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
|
1489 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
|
1490 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1491 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1492 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
|
1493 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1494 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1495 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1496 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1497 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
|
1498 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
|
1499 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1500 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1501 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
1502 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
|
1503 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1504 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
|
1505 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
|
1506 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
|
1507 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
|
1508 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
|
1509 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1510 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
|
1511 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1512 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
|
1513 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1514 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1515 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1516 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1517 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1518 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1519 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
|
1520 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
|
1521 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1522 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1523 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1524 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
|
1525 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
|
1526 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1527 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1528 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1529 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1530 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1531 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1532 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1533 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1534 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1535 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1536 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1537 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1538 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
|
1539 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1540 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1541 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
|
1542 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1543 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
|
1544 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
|
1545 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1546 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1547 srcB = (srcB * modulateB) / 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 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
|
1550 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1551 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1552 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
|
1553 /* 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
|
1554 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1555 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1556 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1557 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1558 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1559 } |
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
|
1560 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1561 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1562 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
|
1563 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
|
1564 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
|
1565 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1566 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1567 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
|
1568 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
|
1569 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
|
1570 break; |
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 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
|
1573 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1574 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1575 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1576 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1577 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1578 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
|
1579 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1580 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1581 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
1582 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
|
1583 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1584 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
|
1585 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1586 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1587 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1588 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1589 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1590 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1591 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
|
1592 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
|
1593 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1594 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1595 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1596 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
|
1597 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
|
1598 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1599 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1600 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1601 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1602 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1603 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1604 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1605 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1606 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1607 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1608 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1609 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1610 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
|
1611 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1612 *dst = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1613 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1614 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1615 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1616 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1617 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
|
1618 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1619 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1620 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
1621 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
|
1622 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1623 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
|
1624 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1625 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
|
1626 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1627 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
|
1628 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1629 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1630 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
|
1631 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
|
1632 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
|
1633 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1634 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1635 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
|
1636 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1637 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
|
1638 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
|
1639 /* 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
|
1640 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1641 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1642 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1643 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1644 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1645 } |
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
|
1646 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1647 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1648 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
|
1649 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
|
1650 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
|
1651 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1652 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1653 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
|
1654 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
|
1655 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
|
1656 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1657 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1658 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
|
1659 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1660 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1661 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1662 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1663 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
|
1664 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
|
1665 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1666 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1667 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
1668 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
|
1669 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1670 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
|
1671 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1672 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
|
1673 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1674 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
|
1675 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1676 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1677 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1678 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1679 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1680 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1681 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
|
1682 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
|
1683 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1684 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1685 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1686 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
|
1687 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
|
1688 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1689 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1690 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1691 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1692 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1693 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1694 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1695 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1696 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1697 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1698 posx -= 0x10000L; |
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 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
|
1701 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1702 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1703 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
|
1704 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1705 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
|
1706 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
|
1707 /* 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
|
1708 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1709 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1710 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1711 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1712 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1713 } |
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
|
1714 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1715 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1716 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
|
1717 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
|
1718 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
|
1719 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1720 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1721 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
|
1722 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
|
1723 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
|
1724 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1725 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1726 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
|
1727 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1728 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1729 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1730 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1731 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1732 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
|
1733 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1734 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1735 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
1736 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
|
1737 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1738 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
|
1739 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
|
1740 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
|
1741 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
|
1742 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
|
1743 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1744 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
|
1745 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1746 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1747 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
|
1748 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
|
1749 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
|
1750 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1751 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1752 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
|
1753 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
|
1754 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1755 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1756 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1757 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1758 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
|
1759 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1760 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1761 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
|
1762 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1763 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1764 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1765 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1766 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
|
1767 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
|
1768 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1769 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1770 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
1771 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
|
1772 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1773 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
|
1774 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
|
1775 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
|
1776 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
|
1777 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
|
1778 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1779 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
|
1780 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1781 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1782 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1783 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1784 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1785 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1786 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
|
1787 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
|
1788 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1789 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1790 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1791 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
|
1792 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
|
1793 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1794 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1795 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1796 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1797 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1798 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1799 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1800 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1801 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1802 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1803 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1804 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1805 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
|
1806 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1807 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1808 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
|
1809 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
|
1810 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1811 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1812 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1813 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1814 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
|
1815 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1816 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1817 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
|
1818 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1819 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1820 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1821 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1822 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1823 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
|
1824 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1825 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1826 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
1827 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
|
1828 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1829 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
|
1830 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
|
1831 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
|
1832 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
|
1833 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
|
1834 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1835 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
|
1836 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1837 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
|
1838 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1839 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1840 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
|
1841 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
|
1842 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
|
1843 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1844 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1845 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
|
1846 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1847 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
|
1848 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
|
1849 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1850 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1851 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1852 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1853 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
|
1854 srcA = (srcA * modulateA) / 255; |
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 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
|
1857 /* 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
|
1858 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1859 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1860 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1861 srcB = (srcB * srcA) / 255; |
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 } |
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
|
1864 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1865 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1866 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
|
1867 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
|
1868 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
|
1869 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1870 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1871 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
|
1872 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
|
1873 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
|
1874 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1875 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1876 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
|
1877 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1878 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1879 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1880 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1881 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
|
1882 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
|
1883 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1884 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1885 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
1886 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
|
1887 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1888 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
|
1889 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
|
1890 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
|
1891 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
|
1892 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
|
1893 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1894 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
|
1895 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1896 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
|
1897 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1898 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1899 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1900 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1901 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1902 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1903 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
|
1904 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
|
1905 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1906 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1907 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1908 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
|
1909 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
|
1910 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1911 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1912 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1913 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1914 posy -= 0x10000L; |
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 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1917 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1918 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1919 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1920 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1921 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1922 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
|
1923 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1924 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1925 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
|
1926 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1927 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
|
1928 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
|
1929 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1930 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1931 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1932 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1933 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
|
1934 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1935 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1936 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
|
1937 /* 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
|
1938 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1939 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1940 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1941 srcB = (srcB * srcA) / 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 } |
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
|
1944 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1945 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1946 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
|
1947 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
|
1948 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
|
1949 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1950 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1951 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
|
1952 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
|
1953 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
|
1954 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1955 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1956 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
|
1957 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1958 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1959 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1960 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1961 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1962 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
|
1963 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1964 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1965 |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1966 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
|
1967 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1968 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1969 Uint32 pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1970 Uint32 R, G, B, A; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1971 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1972 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1973 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1974 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1975 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1976 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1977 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
|
1978 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
|
1979 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1980 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1981 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1982 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1983 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1984 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1985 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1986 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1987 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1988 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1989 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1990 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1991 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1992 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1993 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1994 posx -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1995 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1996 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
|
1997 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1998 pixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
1999 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
|
2000 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
|
2001 *dst = pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2002 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2003 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2004 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2005 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2006 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2007 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2008 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2009 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2010 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
|
2011 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2012 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2013 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2014 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2015 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2016 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2017 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2018 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2019 Uint32 *src = (Uint32 *)info->src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2020 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2021 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2022 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2023 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2024 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
|
2025 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2026 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
|
2027 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
|
2028 /* 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
|
2029 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2030 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2031 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2032 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2033 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2034 } |
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
|
2035 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2036 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2037 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
|
2038 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
|
2039 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
|
2040 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2041 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2042 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
|
2043 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
|
2044 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
|
2045 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2046 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2047 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
|
2048 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2049 ++src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2050 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2051 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2052 info->src += info->src_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2053 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2054 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2055 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2056 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2057 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
|
2058 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2059 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2060 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2061 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2062 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2063 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2064 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2065 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2066 int incy, incx; |
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 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2069 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2070 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
|
2071 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
|
2072 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2073 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2074 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2075 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2076 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2077 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2078 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2079 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2080 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2081 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2082 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2083 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2084 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2085 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2086 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2087 posx -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2088 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2089 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
|
2090 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2091 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2092 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
|
2093 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2094 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
|
2095 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
|
2096 /* 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
|
2097 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2098 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2099 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2100 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2101 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2102 } |
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
|
2103 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2104 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2105 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
|
2106 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
|
2107 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
|
2108 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2109 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2110 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
|
2111 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
|
2112 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
|
2113 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2114 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2115 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
|
2116 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2117 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2118 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2119 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2120 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2121 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2122 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2123 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2124 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2125 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
|
2126 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2127 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2128 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2129 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2130 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2131 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2132 Uint32 pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2133 Uint32 R, G, B, A; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2134 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2135 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2136 Uint32 *src = (Uint32 *)info->src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2137 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2138 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2139 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2140 pixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2141 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
|
2142 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
|
2143 R = (R * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2144 G = (G * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2145 B = (B * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2146 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2147 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
|
2148 A = (A * modulateA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2149 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2150 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
|
2151 *dst = pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2152 ++src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2153 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2154 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2155 info->src += info->src_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2156 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2157 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2158 } |
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 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
|
2161 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2162 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2163 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2164 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2165 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2166 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2167 Uint32 pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2168 Uint32 R, G, B, A; |
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 pixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2197 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
|
2198 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
|
2199 R = (R * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2200 G = (G * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2201 B = (B * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2202 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2203 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
|
2204 A = (A * modulateA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2205 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2206 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
|
2207 *dst = pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2208 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2209 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2210 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2211 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2212 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2213 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2214 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2215 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2216 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
|
2217 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2218 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2219 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2220 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2221 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2222 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2223 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2224 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2225 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2226 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2227 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2228 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2229 Uint32 *src = (Uint32 *)info->src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2230 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2231 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2232 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2233 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2234 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
|
2235 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2236 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
|
2237 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
|
2238 srcR = (srcR * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2239 srcG = (srcG * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2240 srcB = (srcB * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2241 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2242 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
|
2243 srcA = (srcA * modulateA) / 255; |
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 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
|
2246 /* 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
|
2247 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2248 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2249 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2250 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2251 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2252 } |
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
|
2253 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2254 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2255 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
|
2256 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
|
2257 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
|
2258 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2259 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2260 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
|
2261 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
|
2262 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
|
2263 break; |
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 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
|
2266 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2267 ++src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2268 ++dst; |
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 info->src += info->src_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2271 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2272 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2273 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2274 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2275 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
|
2276 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2277 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2278 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2279 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2280 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2281 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2282 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2283 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2284 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2285 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2286 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2287 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2288 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2289 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2290 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2291 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2292 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
|
2293 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
|
2294 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2295 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2296 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2297 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2298 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2299 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2300 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2301 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2302 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2303 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2304 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2305 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2306 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2307 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2308 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2309 posx -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2310 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2311 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
|
2312 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2313 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2314 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
|
2315 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2316 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
|
2317 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
|
2318 srcR = (srcR * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2319 srcG = (srcG * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2320 srcB = (srcB * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2321 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2322 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
|
2323 srcA = (srcA * modulateA) / 255; |
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 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
|
2326 /* 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
|
2327 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2328 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2329 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2330 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2331 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2332 } |
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
|
2333 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2334 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2335 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
|
2336 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
|
2337 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
|
2338 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2339 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2340 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
|
2341 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
|
2342 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
|
2343 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2344 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2345 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
|
2346 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2347 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2348 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2349 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2350 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2351 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2352 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2353 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
2354 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
2355 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
|
2356 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2357 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
|
2358 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2359 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
|
2360 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2361 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2362 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2363 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2364 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2365 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2366 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
|
2367 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
|
2368 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2369 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2370 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2371 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
|
2372 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
|
2373 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2374 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2375 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2376 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2377 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2378 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2379 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2380 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2381 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2382 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2383 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2384 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2385 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
|
2386 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2387 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2388 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
|
2389 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
|
2390 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2391 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2392 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2393 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2394 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2395 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
|
2396 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2397 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2398 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
2399 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
|
2400 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2401 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
|
2402 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2403 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
|
2404 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2405 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
|
2406 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2407 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2408 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
|
2409 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
|
2410 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
|
2411 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2412 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2413 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
|
2414 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2415 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
|
2416 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
|
2417 /* 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
|
2418 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2419 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2420 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2421 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2422 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2423 } |
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
|
2424 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2425 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2426 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
|
2427 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
|
2428 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
|
2429 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2430 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2431 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
|
2432 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
|
2433 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
|
2434 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2435 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2436 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
|
2437 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2438 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2439 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2440 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2441 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
|
2442 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
|
2443 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2444 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2445 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
2446 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
|
2447 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2448 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
|
2449 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2450 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
|
2451 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2452 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
|
2453 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2454 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2455 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2456 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2457 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2458 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2459 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
|
2460 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
|
2461 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2462 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2463 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2464 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
|
2465 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
|
2466 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2467 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2468 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2469 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2470 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2471 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2472 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2473 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2474 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2475 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2476 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2477 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2478 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
|
2479 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2480 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2481 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
|
2482 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2483 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
|
2484 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
|
2485 /* 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
|
2486 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2487 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2488 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2489 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2490 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2491 } |
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
|
2492 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2493 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2494 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
|
2495 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
|
2496 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
|
2497 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2498 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2499 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
|
2500 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
|
2501 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
|
2502 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2503 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2504 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
|
2505 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2506 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2507 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2508 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2509 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2510 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
|
2511 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2512 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2513 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
2514 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
|
2515 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2516 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
|
2517 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
|
2518 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
|
2519 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
|
2520 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
|
2521 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2522 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
|
2523 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2524 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2525 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
|
2526 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
|
2527 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
|
2528 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2529 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2530 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
|
2531 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
|
2532 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2533 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2534 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2535 } |
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_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2537 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2538 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2539 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
|
2540 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2541 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2542 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2543 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2544 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
|
2545 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
|
2546 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2547 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2548 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
2549 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
|
2550 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2551 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
|
2552 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
|
2553 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
|
2554 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
|
2555 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
|
2556 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2557 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
|
2558 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2559 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2560 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2561 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2562 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2563 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2564 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
|
2565 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
|
2566 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2567 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2568 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2569 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
|
2570 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
|
2571 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2572 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2573 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2574 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2575 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2576 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2577 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2578 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2579 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2580 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2581 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2582 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2583 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
|
2584 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2585 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2586 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
|
2587 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
|
2588 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2589 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2590 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2591 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2592 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
|
2593 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2594 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2595 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
|
2596 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2597 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2598 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2599 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2600 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2601 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
|
2602 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2603 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2604 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
2605 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
|
2606 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2607 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
|
2608 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
|
2609 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
|
2610 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
|
2611 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
|
2612 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2613 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
|
2614 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2615 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
|
2616 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2617 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2618 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
|
2619 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
|
2620 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
|
2621 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2622 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2623 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
|
2624 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2625 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
|
2626 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
|
2627 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2628 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2629 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2630 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2631 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
|
2632 srcA = (srcA * modulateA) / 255; |
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 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
|
2635 /* 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
|
2636 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2637 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2638 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2639 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2640 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2641 } |
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
|
2642 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2643 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2644 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
|
2645 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
|
2646 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
|
2647 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2648 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2649 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
|
2650 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
|
2651 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
|
2652 break; |
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 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
|
2655 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2656 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2657 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2658 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2659 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
|
2660 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
|
2661 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2662 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2663 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
2664 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
|
2665 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2666 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
|
2667 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
|
2668 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
|
2669 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
|
2670 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
|
2671 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2672 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
|
2673 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2674 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
|
2675 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2676 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2677 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2678 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2679 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2680 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2681 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
|
2682 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
|
2683 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2684 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2685 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2686 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
|
2687 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
|
2688 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2689 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2690 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2691 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2692 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2693 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2694 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2695 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2696 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2697 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2698 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2699 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2700 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
|
2701 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2702 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2703 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
|
2704 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2705 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
|
2706 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
|
2707 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2708 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2709 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2710 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2711 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
|
2712 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2713 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2714 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
|
2715 /* 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
|
2716 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2717 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2718 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2719 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2720 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2721 } |
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
|
2722 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2723 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2724 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
|
2725 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
|
2726 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
|
2727 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2728 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2729 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
|
2730 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
|
2731 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
|
2732 break; |
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 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
|
2735 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2736 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2737 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2738 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2739 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2740 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
|
2741 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2742 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2743 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
2744 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
|
2745 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2746 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
|
2747 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2748 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
|
2749 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2750 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2751 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2752 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2753 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2754 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2755 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
|
2756 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
|
2757 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2758 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2759 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2760 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
|
2761 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
|
2762 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2763 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2764 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2765 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2766 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2767 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2768 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2769 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2770 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2771 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2772 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2773 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2774 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
|
2775 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2776 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2777 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
|
2778 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
|
2779 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2780 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2781 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2782 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2783 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2784 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
|
2785 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2786 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2787 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
2788 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
|
2789 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2790 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
|
2791 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2792 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
|
2793 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2794 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
|
2795 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2796 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2797 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
|
2798 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
|
2799 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
|
2800 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2801 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2802 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
|
2803 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2804 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
|
2805 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
|
2806 /* 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
|
2807 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2808 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2809 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2810 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2811 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2812 } |
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
|
2813 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2814 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2815 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
|
2816 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
|
2817 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
|
2818 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2819 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2820 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
|
2821 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
|
2822 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
|
2823 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2824 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2825 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
|
2826 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2827 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2828 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2829 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2830 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
|
2831 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
|
2832 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2833 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2834 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
2835 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
|
2836 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2837 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
|
2838 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2839 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
|
2840 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2841 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
|
2842 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2843 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2844 int incy, incx; |
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 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2847 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2848 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
|
2849 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
|
2850 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2851 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2852 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2853 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
|
2854 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
|
2855 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2856 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2857 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2858 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2859 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2860 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2861 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2862 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2863 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2864 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2865 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2866 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2867 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
|
2868 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2869 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2870 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
|
2871 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2872 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
|
2873 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
|
2874 /* 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
|
2875 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2876 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2877 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2878 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2879 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2880 } |
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
|
2881 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2882 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2883 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
|
2884 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
|
2885 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
|
2886 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2887 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2888 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
|
2889 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
|
2890 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
|
2891 break; |
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 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
|
2894 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2895 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2896 ++dst; |
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 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2899 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
|
2900 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2901 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2902 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
2903 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
|
2904 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2905 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
|
2906 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
|
2907 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
|
2908 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
|
2909 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
|
2910 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2911 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
|
2912 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2913 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2914 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
|
2915 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
|
2916 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
|
2917 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2918 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2919 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
|
2920 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
|
2921 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2922 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2923 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2924 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2925 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
|
2926 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2927 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2928 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
|
2929 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2930 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2931 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2932 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2933 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
|
2934 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
|
2935 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2936 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2937 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
2938 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
|
2939 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2940 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
|
2941 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
|
2942 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
|
2943 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
|
2944 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
|
2945 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2946 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
|
2947 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2948 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2949 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2950 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2951 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2952 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2953 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
|
2954 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
|
2955 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2956 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2957 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2958 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
|
2959 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
|
2960 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2961 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2962 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2963 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2964 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2965 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2966 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2967 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2968 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2969 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2970 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2971 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2972 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
|
2973 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2974 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2975 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
|
2976 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
|
2977 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2978 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2979 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2980 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2981 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
|
2982 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2983 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2984 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
|
2985 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2986 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2987 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2988 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2989 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2990 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
|
2991 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2992 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2993 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
2994 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
|
2995 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2996 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
|
2997 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
|
2998 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
|
2999 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
|
3000 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
|
3001 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3002 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
|
3003 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3004 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
|
3005 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3006 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3007 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
|
3008 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
|
3009 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
|
3010 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3011 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3012 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
|
3013 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3014 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
|
3015 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
|
3016 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3017 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3018 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3019 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3020 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
|
3021 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3022 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3023 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
|
3024 /* 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
|
3025 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3026 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3027 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3028 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3029 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3030 } |
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
|
3031 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3032 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3033 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
|
3034 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
|
3035 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
|
3036 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3037 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3038 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
|
3039 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
|
3040 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
|
3041 break; |
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 ++src; |
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 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
|
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_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
|
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 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3061 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
|
3062 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3063 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
|
3064 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3065 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3066 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3067 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3068 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3069 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3070 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
|
3071 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
|
3072 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3073 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3074 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3075 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
|
3076 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
|
3077 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3078 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3079 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3080 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3081 posy -= 0x10000L; |
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 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3084 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3085 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3086 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3087 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3088 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3089 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
|
3090 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3091 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3092 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
|
3093 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3094 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
|
3095 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
|
3096 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3097 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3098 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3099 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3100 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
|
3101 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3102 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3103 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
|
3104 /* 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
|
3105 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3106 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3107 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3108 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3109 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3110 } |
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
|
3111 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3112 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3113 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
|
3114 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
|
3115 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
|
3116 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3117 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3118 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
|
3119 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
|
3120 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
|
3121 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3122 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3123 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
|
3124 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3125 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3126 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3127 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3128 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3129 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
|
3130 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3131 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3132 |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3133 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
|
3134 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3135 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3136 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3137 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3138 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3139 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3140 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3141 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3142 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
|
3143 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
|
3144 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3145 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3146 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3147 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3148 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3149 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3150 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3151 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3152 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3153 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3154 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3155 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3156 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3157 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3158 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3159 posx -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3160 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3161 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
|
3162 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3163 *dst = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3164 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3165 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3166 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3167 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3168 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3169 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3170 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3171 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3172 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
|
3173 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3174 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3175 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3176 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3177 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3178 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3179 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3180 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3181 Uint32 *src = (Uint32 *)info->src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3182 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3183 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3184 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3185 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3186 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
|
3187 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3188 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
|
3189 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
|
3190 /* 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
|
3191 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3192 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3193 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3194 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3195 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3196 } |
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
|
3197 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3198 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3199 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
|
3200 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
|
3201 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
|
3202 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3203 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3204 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
|
3205 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
|
3206 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
|
3207 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3208 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3209 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
|
3210 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3211 ++src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3212 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3213 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3214 info->src += info->src_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3215 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3216 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3217 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3218 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3219 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
|
3220 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3221 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3222 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3223 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3224 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3225 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3226 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3227 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3228 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3229 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3230 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3231 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3232 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
|
3233 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
|
3234 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3235 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3236 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3237 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3238 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3239 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3240 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3241 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3242 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3243 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3244 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3245 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3246 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3247 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3248 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3249 posx -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3250 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3251 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
|
3252 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3253 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3254 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
|
3255 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3256 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
|
3257 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
|
3258 /* 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
|
3259 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3260 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3261 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3262 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3263 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3264 } |
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
|
3265 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3266 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3267 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
|
3268 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
|
3269 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
|
3270 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3271 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3272 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
|
3273 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
|
3274 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
|
3275 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3276 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3277 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
|
3278 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3279 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3280 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3281 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3282 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3283 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3284 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3285 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3286 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3287 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
|
3288 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3289 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3290 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3291 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3292 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3293 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3294 Uint32 pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3295 Uint32 R, G, B, A; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3296 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3297 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3298 Uint32 *src = (Uint32 *)info->src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3299 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3300 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3301 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3302 pixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3303 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
|
3304 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
|
3305 R = (R * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3306 G = (G * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3307 B = (B * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3308 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3309 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
|
3310 A = (A * modulateA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3311 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3312 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
|
3313 *dst = pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3314 ++src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3315 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3316 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3317 info->src += info->src_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3318 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3319 } |
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 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3322 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
|
3323 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3324 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3325 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3326 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3327 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3328 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3329 Uint32 pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3330 Uint32 R, G, B, A; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3331 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3332 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3333 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3334 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3335 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3336 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3337 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
|
3338 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
|
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; |
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 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3345 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3346 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3347 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3348 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3349 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3350 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3351 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3352 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3353 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3354 posx -= 0x10000L; |
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 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
|
3357 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3358 pixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3359 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
|
3360 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
|
3361 R = (R * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3362 G = (G * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3363 B = (B * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3364 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3365 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
|
3366 A = (A * modulateA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3367 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3368 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
|
3369 *dst = pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3370 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3371 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3372 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3373 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3374 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3375 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3376 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3377 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3378 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
|
3379 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3380 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3381 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3382 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3383 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3384 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3385 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3386 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3387 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3388 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3389 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3390 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3391 Uint32 *src = (Uint32 *)info->src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3392 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3393 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3394 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3395 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3396 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
|
3397 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3398 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
|
3399 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
|
3400 srcR = (srcR * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3401 srcG = (srcG * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3402 srcB = (srcB * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3403 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3404 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
|
3405 srcA = (srcA * modulateA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3406 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3407 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
|
3408 /* 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
|
3409 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3410 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3411 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3412 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3413 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3414 } |
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
|
3415 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3416 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3417 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
|
3418 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
|
3419 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
|
3420 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3421 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3422 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
|
3423 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
|
3424 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
|
3425 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3426 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3427 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
|
3428 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3429 ++src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3430 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3431 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3432 info->src += info->src_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3433 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3434 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3435 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3436 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3437 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
|
3438 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3439 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3440 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3441 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3442 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3443 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3444 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3445 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3446 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3447 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3448 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3449 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3450 int incy, incx; |
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 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3453 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3454 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
|
3455 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
|
3456 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3457 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3458 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3459 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3460 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3461 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3462 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3463 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3464 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3465 posy -= 0x10000L; |
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 (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3468 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3469 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3470 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3471 posx -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3472 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3473 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
|
3474 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3475 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3476 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
|
3477 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3478 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
|
3479 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
|
3480 srcR = (srcR * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3481 srcG = (srcG * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3482 srcB = (srcB * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3483 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3484 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
|
3485 srcA = (srcA * modulateA) / 255; |
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 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
|
3488 /* 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
|
3489 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3490 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3491 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3492 srcB = (srcB * srcA) / 255; |
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 } |
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
|
3495 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3496 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3497 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
|
3498 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
|
3499 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
|
3500 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3501 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3502 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
|
3503 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
|
3504 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
|
3505 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3506 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3507 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
|
3508 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3509 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3510 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3511 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3512 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3513 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3514 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3515 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
3516 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
3517 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
|
3518 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3519 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
|
3520 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3521 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
|
3522 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3523 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3524 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3525 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3526 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3527 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3528 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
|
3529 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
|
3530 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3531 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3532 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3533 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
|
3534 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
|
3535 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3536 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3537 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3538 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3539 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3540 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3541 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3542 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3543 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3544 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3545 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3546 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3547 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
|
3548 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3549 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3550 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
|
3551 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
|
3552 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3553 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3554 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3555 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3556 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3557 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
|
3558 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3559 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3560 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
3561 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
|
3562 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3563 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
|
3564 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3565 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
|
3566 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3567 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
|
3568 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3569 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3570 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
|
3571 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
|
3572 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
|
3573 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3574 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3575 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
|
3576 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3577 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
|
3578 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
|
3579 /* 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
|
3580 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3581 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3582 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3583 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3584 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3585 } |
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
|
3586 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3587 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3588 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
|
3589 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
|
3590 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
|
3591 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3592 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3593 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
|
3594 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
|
3595 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
|
3596 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3597 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3598 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
|
3599 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3600 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3601 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3602 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3603 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
|
3604 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
|
3605 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3606 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3607 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
3608 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
|
3609 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3610 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
|
3611 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3612 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
|
3613 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3614 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
|
3615 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3616 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3617 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3618 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3619 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3620 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3621 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
|
3622 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
|
3623 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3624 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3625 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3626 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
|
3627 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
|
3628 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3629 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3630 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3631 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3632 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3633 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3634 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3635 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3636 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3637 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3638 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3639 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3640 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
|
3641 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3642 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3643 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
|
3644 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3645 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
|
3646 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
|
3647 /* 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
|
3648 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3649 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3650 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3651 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3652 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3653 } |
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
|
3654 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3655 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3656 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
|
3657 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
|
3658 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
|
3659 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3660 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3661 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
|
3662 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
|
3663 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
|
3664 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3665 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3666 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
|
3667 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3668 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3669 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3670 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3671 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3672 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
|
3673 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3674 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3675 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
3676 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
|
3677 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3678 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
|
3679 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
|
3680 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
|
3681 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
|
3682 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
|
3683 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3684 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
|
3685 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3686 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3687 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
|
3688 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
|
3689 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
|
3690 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3691 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3692 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
|
3693 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
|
3694 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3695 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3696 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3697 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3698 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
|
3699 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3700 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3701 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
|
3702 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3703 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3704 ++dst; |
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 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
|
3707 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
|
3708 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3709 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3710 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
3711 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
|
3712 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3713 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
|
3714 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
|
3715 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
|
3716 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
|
3717 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
|
3718 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3719 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
|
3720 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3721 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3722 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3723 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3724 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3725 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3726 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
|
3727 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
|
3728 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3729 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3730 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3731 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
|
3732 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
|
3733 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3734 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3735 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3736 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3737 posy -= 0x10000L; |
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 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3740 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3741 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3742 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3743 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3744 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3745 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
|
3746 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3747 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3748 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
|
3749 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
|
3750 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3751 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3752 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3753 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3754 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
|
3755 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3756 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3757 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
|
3758 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3759 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3760 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3761 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3762 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3763 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
|
3764 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3765 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3766 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
3767 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
|
3768 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3769 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
|
3770 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
|
3771 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
|
3772 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
|
3773 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
|
3774 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3775 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
|
3776 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3777 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
|
3778 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3779 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3780 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
|
3781 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
|
3782 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
|
3783 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3784 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3785 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
|
3786 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3787 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
|
3788 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
|
3789 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3790 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3791 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3792 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3793 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
|
3794 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3795 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3796 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
|
3797 /* 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
|
3798 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3799 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3800 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3801 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3802 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3803 } |
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
|
3804 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3805 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3806 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
|
3807 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
|
3808 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
|
3809 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3810 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3811 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
|
3812 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
|
3813 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
|
3814 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3815 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3816 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
|
3817 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3818 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3819 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3820 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3821 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
|
3822 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
|
3823 } |
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 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
3826 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
|
3827 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3828 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
|
3829 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
|
3830 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
|
3831 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
|
3832 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
|
3833 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3834 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
|
3835 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3836 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
|
3837 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3838 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3839 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3840 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3841 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3842 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3843 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
|
3844 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
|
3845 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3846 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3847 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3848 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
|
3849 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
|
3850 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3851 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3852 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3853 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3854 posy -= 0x10000L; |
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 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3857 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3858 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3859 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3860 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3861 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3862 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
|
3863 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3864 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3865 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
|
3866 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3867 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
|
3868 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
|
3869 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3870 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3871 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3872 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3873 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
|
3874 srcA = (srcA * modulateA) / 255; |
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 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
|
3877 /* 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
|
3878 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3879 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3880 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3881 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3882 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3883 } |
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
|
3884 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3885 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3886 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
|
3887 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
|
3888 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
|
3889 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3890 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3891 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
|
3892 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
|
3893 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
|
3894 break; |
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 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
|
3897 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3898 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3899 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3900 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3901 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3902 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
|
3903 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3904 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3905 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
3906 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
|
3907 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3908 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
|
3909 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3910 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
|
3911 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3912 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3913 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3914 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3915 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3916 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3917 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
|
3918 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
|
3919 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3920 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3921 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3922 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
|
3923 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
|
3924 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3925 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3926 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3927 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3928 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3929 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3930 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3931 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3932 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3933 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3934 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3935 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3936 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
|
3937 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3938 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3939 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
|
3940 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
|
3941 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3942 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3943 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3944 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3945 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3946 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
|
3947 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3948 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3949 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
3950 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
|
3951 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3952 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
|
3953 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3954 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
|
3955 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3956 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
|
3957 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3958 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3959 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
|
3960 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
|
3961 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
|
3962 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3963 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3964 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
|
3965 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3966 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
|
3967 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
|
3968 /* 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
|
3969 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3970 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3971 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3972 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3973 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3974 } |
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
|
3975 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3976 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3977 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
|
3978 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
|
3979 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
|
3980 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3981 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3982 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
|
3983 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
|
3984 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
|
3985 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3986 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3987 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
|
3988 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3989 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3990 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3991 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3992 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
|
3993 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
|
3994 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3995 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3996 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
3997 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
|
3998 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3999 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
|
4000 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4001 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
|
4002 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4003 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
|
4004 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4005 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4006 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4007 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4008 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4009 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4010 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
|
4011 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
|
4012 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4013 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4014 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4015 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
|
4016 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
|
4017 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4018 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4019 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4020 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4021 posy -= 0x10000L; |
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 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4024 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4025 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4026 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4027 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4028 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4029 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
|
4030 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4031 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4032 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
|
4033 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4034 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
|
4035 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
|
4036 /* 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
|
4037 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4038 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4039 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4040 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4041 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4042 } |
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
|
4043 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4044 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4045 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
|
4046 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
|
4047 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
|
4048 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4049 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4050 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
|
4051 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
|
4052 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
|
4053 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4054 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4055 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
|
4056 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4057 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4058 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4059 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4060 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4061 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
|
4062 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4063 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4064 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
4065 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
|
4066 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4067 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
|
4068 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
|
4069 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
|
4070 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
|
4071 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
|
4072 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4073 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
|
4074 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4075 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4076 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
|
4077 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
|
4078 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
|
4079 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4080 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4081 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
|
4082 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
|
4083 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4084 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4085 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4086 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4087 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
|
4088 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4089 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4090 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
|
4091 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4092 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4093 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4094 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4095 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
|
4096 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
|
4097 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4098 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4099 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
4100 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
|
4101 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4102 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
|
4103 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
|
4104 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
|
4105 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
|
4106 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
|
4107 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4108 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
|
4109 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4110 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4111 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4112 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4113 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4114 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4115 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
|
4116 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
|
4117 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4118 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4119 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4120 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
|
4121 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
|
4122 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4123 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4124 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4125 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4126 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4127 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4128 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4129 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4130 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4131 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4132 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4133 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4134 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
|
4135 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4136 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4137 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
|
4138 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
|
4139 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4140 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4141 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4142 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4143 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
|
4144 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4145 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4146 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
|
4147 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4148 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4149 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4150 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4151 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4152 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
|
4153 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4154 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4155 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
4156 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
|
4157 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4158 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
|
4159 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
|
4160 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
|
4161 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
|
4162 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
|
4163 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4164 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
|
4165 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4166 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
|
4167 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4168 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4169 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
|
4170 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
|
4171 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
|
4172 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4173 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4174 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
|
4175 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4176 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
|
4177 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
|
4178 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4179 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4180 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4181 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4182 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
|
4183 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4184 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4185 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
|
4186 /* 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
|
4187 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4188 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4189 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4190 srcB = (srcB * srcA) / 255; |
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 } |
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
|
4193 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4194 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4195 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
|
4196 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
|
4197 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
|
4198 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4199 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4200 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
|
4201 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
|
4202 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
|
4203 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4204 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4205 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
|
4206 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4207 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4208 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4209 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4210 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
|
4211 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
|
4212 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4213 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4214 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
4215 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
|
4216 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4217 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
|
4218 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
|
4219 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
|
4220 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
|
4221 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
|
4222 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4223 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
|
4224 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4225 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
|
4226 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4227 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4228 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4229 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4230 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4231 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4232 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
|
4233 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
|
4234 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4235 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4236 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4237 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4238 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4239 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4240 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4241 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4242 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4243 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4244 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4245 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4246 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4247 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4248 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4249 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4250 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4251 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
|
4252 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4253 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4254 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
|
4255 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4256 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
|
4257 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
|
4258 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4259 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4260 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4261 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4262 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
|
4263 srcA = (srcA * modulateA) / 255; |
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 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
|
4266 /* 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
|
4267 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4268 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4269 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4270 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4271 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4272 } |
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
|
4273 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4274 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4275 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
|
4276 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
|
4277 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
|
4278 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4279 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4280 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
|
4281 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
|
4282 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
|
4283 break; |
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 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
|
4286 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4287 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4288 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4289 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4290 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4291 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
|
4292 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4293 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4294 |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4295 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
|
4296 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4297 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4298 Uint32 pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4299 Uint32 R, G, B, A; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4300 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4301 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4302 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4303 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4304 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4305 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4306 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
|
4307 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
|
4308 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4309 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4310 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4311 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4312 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4313 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4314 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4315 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4316 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4317 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4318 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4319 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4320 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4321 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4322 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4323 posx -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4324 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4325 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
|
4326 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4327 pixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4328 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
|
4329 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
|
4330 *dst = pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4331 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4332 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4333 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4334 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4335 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4336 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4337 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4338 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4339 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
|
4340 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4341 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4342 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4343 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4344 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4345 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4346 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4347 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4348 Uint32 *src = (Uint32 *)info->src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4349 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4350 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4351 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4352 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4353 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
|
4354 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4355 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
|
4356 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
|
4357 /* 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
|
4358 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4359 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4360 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4361 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4362 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4363 } |
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
|
4364 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4365 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4366 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
|
4367 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
|
4368 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
|
4369 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4370 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4371 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
|
4372 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
|
4373 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
|
4374 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4375 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4376 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
|
4377 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4378 ++src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4379 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4380 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4381 info->src += info->src_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4382 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4383 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4384 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4385 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4386 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
|
4387 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4388 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4389 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4390 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4391 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4392 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4393 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4394 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4395 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4396 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4397 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4398 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4399 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
|
4400 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
|
4401 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4402 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4403 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4404 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4405 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4406 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4407 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4408 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4409 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4410 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4411 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4412 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4413 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4414 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4415 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4416 posx -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4417 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4418 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
|
4419 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4420 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4421 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
|
4422 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4423 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
|
4424 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
|
4425 /* 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
|
4426 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4427 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4428 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4429 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4430 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4431 } |
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
|
4432 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4433 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4434 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
|
4435 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
|
4436 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
|
4437 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4438 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4439 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
|
4440 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
|
4441 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
|
4442 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4443 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4444 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
|
4445 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4446 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4447 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4448 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4449 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4450 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4451 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4452 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4453 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4454 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
|
4455 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4456 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4457 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4458 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4459 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4460 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4461 Uint32 pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4462 Uint32 R, G, B, A; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4463 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4464 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4465 Uint32 *src = (Uint32 *)info->src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4466 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4467 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4468 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4469 pixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4470 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
|
4471 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
|
4472 R = (R * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4473 G = (G * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4474 B = (B * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4475 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4476 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
|
4477 A = (A * modulateA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4478 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4479 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
|
4480 *dst = pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4481 ++src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4482 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4483 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4484 info->src += info->src_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4485 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4486 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4487 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4488 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4489 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
|
4490 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4491 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4492 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4493 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4494 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4495 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4496 Uint32 pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4497 Uint32 R, G, B, A; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4498 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4499 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4500 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4501 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4502 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4503 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4504 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
|
4505 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
|
4506 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4507 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4508 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4509 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4510 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4511 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4512 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4513 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4514 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4515 posy -= 0x10000L; |
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 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4518 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4519 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4520 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4521 posx -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4522 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4523 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
|
4524 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4525 pixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4526 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
|
4527 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
|
4528 R = (R * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4529 G = (G * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4530 B = (B * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4531 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4532 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
|
4533 A = (A * modulateA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4534 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4535 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
|
4536 *dst = pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4537 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4538 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4539 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4540 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4541 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4542 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4543 } |
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 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
|
4546 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4547 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4548 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4549 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4550 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4551 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4552 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4553 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4554 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4555 Uint32 dstR, dstG, dstB, dstA; |
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 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4558 Uint32 *src = (Uint32 *)info->src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4559 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4560 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4561 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4562 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4563 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
|
4564 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4565 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
|
4566 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
|
4567 srcR = (srcR * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4568 srcG = (srcG * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4569 srcB = (srcB * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4570 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4571 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
|
4572 srcA = (srcA * modulateA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4573 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4574 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
|
4575 /* 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
|
4576 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4577 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4578 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4579 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4580 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4581 } |
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
|
4582 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4583 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4584 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
|
4585 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
|
4586 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
|
4587 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4588 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4589 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
|
4590 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
|
4591 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
|
4592 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4593 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4594 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
|
4595 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4596 ++src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4597 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4598 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4599 info->src += info->src_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4600 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4601 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4602 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4603 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4604 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
|
4605 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4606 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4607 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4608 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4609 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4610 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4611 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4612 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4613 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4614 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4615 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4616 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4617 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4618 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4619 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4620 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4621 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
|
4622 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
|
4623 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4624 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4625 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4626 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4627 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4628 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4629 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4630 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4631 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4632 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4633 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4634 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4635 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4636 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4637 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4638 posx -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4639 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4640 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
|
4641 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4642 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4643 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
|
4644 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4645 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
|
4646 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
|
4647 srcR = (srcR * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4648 srcG = (srcG * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4649 srcB = (srcB * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4650 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4651 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
|
4652 srcA = (srcA * modulateA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4653 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4654 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
|
4655 /* 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
|
4656 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4657 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4658 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4659 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4660 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4661 } |
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
|
4662 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4663 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4664 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
|
4665 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
|
4666 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
|
4667 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4668 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
4669 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
|
4670 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
|
4671 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
|
4672 break; |
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 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
4684 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
|
4685 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4686 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
|
4687 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4688 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
|
4689 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4690 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4691 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4692 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4693 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4694 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4695 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
|
4696 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
|
4697 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4698 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4699 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4700 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
|
4701 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
|
4702 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4703 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4704 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4705 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4706 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4707 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4708 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4709 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4710 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4711 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4712 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4713 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4714 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
|
4715 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4716 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4717 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
|
4718 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
|
4719 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4720 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4721 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4722 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4723 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4724 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
|
4725 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4726 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4727 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
4728 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
|
4729 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4730 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
|
4731 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4732 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
|
4733 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4734 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
|
4735 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4736 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4737 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
|
4738 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
|
4739 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
|
4740 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4741 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4742 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
|
4743 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4744 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
|
4745 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
|
4746 /* 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
|
4747 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4748 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4749 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4750 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4751 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4752 } |
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
|
4753 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4754 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4755 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
|
4756 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
|
4757 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
|
4758 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4759 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4760 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
|
4761 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
|
4762 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
|
4763 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4764 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4765 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
|
4766 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4767 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4768 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4769 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4770 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
|
4771 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
|
4772 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4773 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4774 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
4775 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
|
4776 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4777 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
|
4778 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4779 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
|
4780 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4781 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
|
4782 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4783 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4784 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4785 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4786 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4787 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4788 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
|
4789 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
|
4790 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4791 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4792 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4793 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
|
4794 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
|
4795 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4796 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4797 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4798 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4799 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4800 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4801 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4802 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4803 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4804 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4805 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4806 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4807 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
|
4808 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4809 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4810 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
|
4811 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4812 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
|
4813 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
|
4814 /* 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
|
4815 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4816 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4817 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4818 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4819 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4820 } |
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
|
4821 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4822 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4823 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
|
4824 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
|
4825 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
|
4826 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4827 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4828 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
|
4829 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
|
4830 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
|
4831 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4832 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4833 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
|
4834 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4835 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4836 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4837 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4838 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4839 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
|
4840 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4841 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4842 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
4843 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
|
4844 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4845 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
|
4846 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
|
4847 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
|
4848 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
|
4849 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
|
4850 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4851 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
|
4852 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4853 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4854 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
|
4855 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
|
4856 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
|
4857 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4858 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4859 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
|
4860 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
|
4861 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4862 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4863 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4864 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4865 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
|
4866 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4867 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4868 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
|
4869 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4870 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4871 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4872 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4873 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
|
4874 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
|
4875 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4876 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4877 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
4878 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
|
4879 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4880 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
|
4881 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
|
4882 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
|
4883 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
|
4884 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
|
4885 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4886 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
|
4887 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4888 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4889 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4890 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4891 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4892 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4893 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
|
4894 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
|
4895 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4896 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4897 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4898 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
|
4899 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
|
4900 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4901 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4902 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4903 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4904 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4905 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4906 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4907 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4908 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4909 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4910 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4911 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4912 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
|
4913 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4914 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4915 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
|
4916 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
|
4917 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4918 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4919 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4920 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4921 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
|
4922 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4923 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4924 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
|
4925 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4926 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4927 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4928 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4929 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4930 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
|
4931 } |
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 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
4934 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
|
4935 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4936 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
|
4937 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
|
4938 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
|
4939 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
|
4940 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
|
4941 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4942 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
|
4943 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4944 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
|
4945 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4946 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4947 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
|
4948 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
|
4949 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
|
4950 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4951 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4952 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
|
4953 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4954 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
|
4955 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
|
4956 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4957 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4958 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4959 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4960 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
|
4961 srcA = (srcA * modulateA) / 255; |
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 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
|
4964 /* 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
|
4965 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4966 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4967 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4968 srcB = (srcB * srcA) / 255; |
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 } |
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
|
4971 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4972 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4973 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
|
4974 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
|
4975 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
|
4976 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4977 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4978 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
|
4979 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
|
4980 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
|
4981 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4982 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4983 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
|
4984 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4985 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4986 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4987 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4988 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
|
4989 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
|
4990 } |
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 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
4993 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
|
4994 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4995 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
|
4996 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
|
4997 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
|
4998 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
|
4999 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
|
5000 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5001 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
|
5002 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5003 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
|
5004 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5005 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5006 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5007 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5008 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5009 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5010 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
|
5011 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
|
5012 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5013 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5014 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5015 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
|
5016 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
|
5017 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5018 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5019 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5020 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5021 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5022 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5023 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5024 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5025 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5026 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5027 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5028 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5029 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
|
5030 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5031 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5032 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
|
5033 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5034 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
|
5035 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
|
5036 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5037 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5038 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5039 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5040 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
|
5041 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5042 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5043 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
|
5044 /* 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
|
5045 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5046 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5047 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5048 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5049 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5050 } |
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
|
5051 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5052 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5053 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
|
5054 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
|
5055 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
|
5056 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5057 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5058 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
|
5059 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
|
5060 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
|
5061 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5062 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5063 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
|
5064 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5065 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5066 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5067 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5068 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5069 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
|
5070 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5071 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5072 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5073 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
|
5074 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5075 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
|
5076 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5077 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
|
5078 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5079 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5080 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5081 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5082 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5083 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5084 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
|
5085 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
|
5086 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5087 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5088 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5089 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
|
5090 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
|
5091 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5092 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5093 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5094 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5095 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5096 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5097 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5098 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5099 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5100 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5101 posx -= 0x10000L; |
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 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
|
5104 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5105 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5106 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
|
5107 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
|
5108 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5109 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5110 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5111 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5112 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5113 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
|
5114 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5115 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5116 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5117 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
|
5118 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5119 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
|
5120 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5121 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
|
5122 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5123 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
|
5124 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5125 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5126 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
|
5127 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
|
5128 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
|
5129 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5130 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5131 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
|
5132 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5133 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
|
5134 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
|
5135 /* 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
|
5136 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5137 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5138 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5139 srcB = (srcB * srcA) / 255; |
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 } |
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
|
5142 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5143 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5144 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
|
5145 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
|
5146 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
|
5147 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5148 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5149 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
|
5150 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
|
5151 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
|
5152 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5153 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5154 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
|
5155 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5156 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5157 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5158 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5159 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
|
5160 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
|
5161 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5162 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5163 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5164 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
|
5165 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5166 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
|
5167 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5168 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
|
5169 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5170 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
|
5171 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5172 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5173 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5174 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5175 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5176 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5177 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
|
5178 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
|
5179 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5180 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5181 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5182 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
|
5183 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
|
5184 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5185 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5186 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5187 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5188 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5189 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5190 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5191 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5192 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5193 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5194 posx -= 0x10000L; |
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 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
|
5197 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5198 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5199 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
|
5200 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5201 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
|
5202 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
|
5203 /* 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
|
5204 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5205 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5206 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5207 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5208 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5209 } |
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
|
5210 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5211 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5212 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
|
5213 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
|
5214 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
|
5215 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5216 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5217 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
|
5218 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
|
5219 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
|
5220 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5221 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5222 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
|
5223 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5224 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5225 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5226 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5227 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5228 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
|
5229 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5230 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5231 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5232 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
|
5233 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5234 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
|
5235 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
|
5236 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
|
5237 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
|
5238 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
|
5239 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5240 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
|
5241 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5242 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5243 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
|
5244 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
|
5245 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
|
5246 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5247 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5248 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
|
5249 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
|
5250 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5251 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5252 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5253 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5254 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
|
5255 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5256 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5257 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
|
5258 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5259 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5260 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5261 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5262 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
|
5263 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
|
5264 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5265 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5266 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5267 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
|
5268 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5269 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
|
5270 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
|
5271 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
|
5272 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
|
5273 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
|
5274 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5275 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
|
5276 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5277 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5278 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5279 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5280 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5281 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5282 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
|
5283 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
|
5284 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5285 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5286 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5287 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
|
5288 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
|
5289 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5290 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5291 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5292 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5293 posy -= 0x10000L; |
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 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5296 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5297 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5298 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5299 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5300 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5301 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
|
5302 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5303 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5304 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
|
5305 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
|
5306 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5307 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5308 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5309 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5310 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
|
5311 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5312 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5313 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
|
5314 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5315 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5316 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5317 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5318 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5319 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
|
5320 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5321 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5322 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5323 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
|
5324 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5325 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
|
5326 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
|
5327 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
|
5328 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
|
5329 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
|
5330 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5331 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
|
5332 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5333 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
|
5334 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5335 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5336 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
|
5337 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
|
5338 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
|
5339 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5340 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5341 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
|
5342 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5343 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
|
5344 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
|
5345 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5346 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5347 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5348 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5349 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
|
5350 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5351 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5352 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
|
5353 /* 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
|
5354 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5355 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5356 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5357 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5358 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5359 } |
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
|
5360 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5361 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5362 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
|
5363 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
|
5364 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
|
5365 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5366 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5367 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
|
5368 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
|
5369 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
|
5370 break; |
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 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
|
5373 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5374 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5375 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5376 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5377 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
|
5378 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
|
5379 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5380 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5381 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5382 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
|
5383 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5384 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
|
5385 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
|
5386 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
|
5387 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
|
5388 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
|
5389 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5390 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
|
5391 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5392 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
|
5393 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5394 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5395 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5396 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5397 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5398 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5399 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
|
5400 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
|
5401 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5402 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5403 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5404 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
|
5405 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
|
5406 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5407 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5408 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5409 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5410 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5411 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5412 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5413 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5414 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5415 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5416 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5417 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5418 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
|
5419 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5420 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5421 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
|
5422 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5423 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
|
5424 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
|
5425 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5426 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5427 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5428 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5429 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
|
5430 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5431 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5432 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
|
5433 /* 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
|
5434 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5435 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5436 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5437 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5438 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5439 } |
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
|
5440 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5441 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5442 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
|
5443 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
|
5444 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
|
5445 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5446 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5447 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
|
5448 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
|
5449 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
|
5450 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5451 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5452 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
|
5453 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5454 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5455 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5456 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5457 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5458 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
|
5459 } |
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 |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5462 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
|
5463 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5464 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5465 Uint32 pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5466 Uint32 R, G, B, A; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5467 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5468 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5469 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5470 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5471 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5472 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5473 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
|
5474 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
|
5475 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5476 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5477 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5478 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5479 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5480 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5481 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5482 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5483 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5484 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5485 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5486 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5487 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5488 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5489 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5490 posx -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5491 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5492 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
|
5493 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5494 pixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5495 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
|
5496 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
|
5497 *dst = pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5498 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5499 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5500 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5501 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5502 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5503 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5504 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5505 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5506 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
|
5507 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5508 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5509 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5510 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5511 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5512 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5513 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5514 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5515 Uint32 *src = (Uint32 *)info->src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5516 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5517 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5518 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5519 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5520 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
|
5521 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5522 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
|
5523 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
|
5524 /* 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
|
5525 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5526 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5527 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5528 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5529 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5530 } |
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
|
5531 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5532 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5533 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
|
5534 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
|
5535 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
|
5536 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5537 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5538 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
|
5539 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
|
5540 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
|
5541 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5542 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5543 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
|
5544 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5545 ++src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5546 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5547 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5548 info->src += info->src_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5549 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5550 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5551 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5552 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5553 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
|
5554 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5555 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5556 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5557 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5558 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5559 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5560 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5561 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5562 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5563 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5564 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5565 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5566 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
|
5567 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
|
5568 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5569 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5570 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5571 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5572 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5573 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5574 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5575 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5576 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5577 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5578 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5579 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5580 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5581 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5582 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5583 posx -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5584 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5585 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
|
5586 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5587 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5588 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
|
5589 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5590 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
|
5591 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
|
5592 /* 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
|
5593 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5594 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5595 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5596 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5597 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5598 } |
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
|
5599 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5600 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5601 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
|
5602 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
|
5603 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
|
5604 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5605 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5606 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
|
5607 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
|
5608 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
|
5609 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5610 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5611 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
|
5612 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5613 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5614 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5615 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5616 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5617 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5618 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5619 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5620 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5621 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
|
5622 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5623 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5624 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5625 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5626 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5627 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5628 Uint32 pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5629 Uint32 R, G, B, A; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5630 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5631 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5632 Uint32 *src = (Uint32 *)info->src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5633 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5634 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5635 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5636 pixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5637 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
|
5638 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
|
5639 R = (R * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5640 G = (G * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5641 B = (B * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5642 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5643 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
|
5644 A = (A * modulateA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5645 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5646 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
|
5647 *dst = pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5648 ++src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5649 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5650 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5651 info->src += info->src_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5652 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5653 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5654 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5655 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5656 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
|
5657 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5658 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5659 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5660 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5661 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5662 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5663 Uint32 pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5664 Uint32 R, G, B, A; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5665 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5666 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5667 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5668 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5669 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5670 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5671 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
|
5672 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
|
5673 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5674 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5675 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5676 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5677 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5678 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5679 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5680 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5681 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5682 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5683 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5684 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5685 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5686 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5687 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5688 posx -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5689 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5690 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
|
5691 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5692 pixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5693 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
|
5694 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
|
5695 R = (R * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5696 G = (G * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5697 B = (B * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5698 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5699 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
|
5700 A = (A * modulateA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5701 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5702 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
|
5703 *dst = pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5704 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5705 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5706 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5707 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5708 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5709 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5710 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5711 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5712 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
|
5713 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5714 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5715 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5716 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5717 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5718 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5719 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5720 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5721 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5722 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5723 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5724 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5725 Uint32 *src = (Uint32 *)info->src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5726 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5727 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5728 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5729 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5730 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
|
5731 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5732 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
|
5733 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
|
5734 srcR = (srcR * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5735 srcG = (srcG * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5736 srcB = (srcB * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5737 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5738 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
|
5739 srcA = (srcA * modulateA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5740 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5741 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
|
5742 /* 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
|
5743 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5744 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5745 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5746 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5747 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5748 } |
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
|
5749 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5750 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5751 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
|
5752 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
|
5753 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
|
5754 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5755 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5756 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
|
5757 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
|
5758 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
|
5759 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5760 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5761 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
|
5762 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5763 ++src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5764 ++dst; |
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 info->src += info->src_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5767 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5768 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5769 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5770 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5771 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
|
5772 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5773 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5774 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5775 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5776 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5777 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5778 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5779 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5780 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5781 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5782 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5783 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5784 int incy, incx; |
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 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5787 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5788 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
|
5789 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
|
5790 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5791 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5792 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5793 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5794 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5795 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5796 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5797 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5798 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5799 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5800 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5801 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5802 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5803 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5804 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5805 posx -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5806 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5807 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
|
5808 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5809 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5810 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
|
5811 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5812 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
|
5813 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
|
5814 srcR = (srcR * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5815 srcG = (srcG * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5816 srcB = (srcB * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5817 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5818 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
|
5819 srcA = (srcA * modulateA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5820 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5821 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
|
5822 /* 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
|
5823 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5824 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5825 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5826 srcB = (srcB * srcA) / 255; |
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 } |
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
|
5829 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5830 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5831 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
|
5832 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
|
5833 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
|
5834 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5835 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5836 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
|
5837 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
|
5838 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
|
5839 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5840 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5841 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
|
5842 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5843 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5844 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5845 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5846 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5847 info->dst += info->dst_pitch; |
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 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
5850 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5851 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
|
5852 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5853 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
|
5854 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5855 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
|
5856 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5857 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5858 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5859 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5860 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5861 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5862 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
|
5863 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
|
5864 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5865 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5866 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5867 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
|
5868 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
|
5869 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5870 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5871 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5872 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5873 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5874 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5875 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5876 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5877 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5878 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5879 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5880 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5881 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
|
5882 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5883 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5884 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
|
5885 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
|
5886 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5887 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5888 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5889 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5890 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5891 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
|
5892 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5893 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5894 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5895 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
|
5896 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5897 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
|
5898 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5899 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
|
5900 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5901 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
|
5902 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5903 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5904 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
|
5905 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
|
5906 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
|
5907 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5908 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5909 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
|
5910 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5911 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
|
5912 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
|
5913 /* 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
|
5914 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5915 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5916 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5917 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5918 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5919 } |
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
|
5920 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5921 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5922 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
|
5923 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
|
5924 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
|
5925 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5926 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5927 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
|
5928 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
|
5929 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
|
5930 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5931 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5932 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
|
5933 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5934 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5935 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5936 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5937 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
|
5938 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
|
5939 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5940 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5941 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5942 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
|
5943 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5944 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
|
5945 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5946 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
|
5947 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5948 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
|
5949 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5950 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5951 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5952 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5953 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5954 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5955 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
|
5956 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
|
5957 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5958 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5959 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5960 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
|
5961 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
|
5962 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5963 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5964 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5965 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5966 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5967 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5968 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5969 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5970 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5971 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5972 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5973 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5974 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
|
5975 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5976 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5977 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
|
5978 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5979 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
|
5980 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
|
5981 /* 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
|
5982 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5983 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5984 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5985 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5986 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5987 } |
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
|
5988 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5989 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5990 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
|
5991 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
|
5992 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
|
5993 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5994 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5995 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
|
5996 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
|
5997 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
|
5998 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5999 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6000 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
|
6001 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6002 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6003 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6004 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6005 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6006 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
|
6007 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6008 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6009 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
6010 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
|
6011 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6012 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
|
6013 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
|
6014 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
|
6015 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
|
6016 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
|
6017 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6018 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
|
6019 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6020 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6021 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
|
6022 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
|
6023 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
|
6024 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6025 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6026 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
|
6027 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
|
6028 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6029 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6030 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6031 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6032 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
|
6033 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6034 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6035 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
|
6036 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6037 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6038 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6039 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6040 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
|
6041 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
|
6042 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6043 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6044 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
6045 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
|
6046 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6047 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
|
6048 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
|
6049 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
|
6050 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
|
6051 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
|
6052 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6053 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
|
6054 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6055 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6056 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6057 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6058 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6059 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6060 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
|
6061 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
|
6062 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6063 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6064 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6065 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
|
6066 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
|
6067 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6068 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6069 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6070 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6071 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6072 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6073 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6074 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6075 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6076 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6077 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6078 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6079 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
|
6080 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6081 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6082 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
|
6083 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
|
6084 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6085 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6086 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6087 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6088 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
|
6089 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6090 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6091 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
|
6092 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6093 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6094 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6095 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6096 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6097 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
|
6098 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6099 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6100 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
6101 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
|
6102 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6103 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
|
6104 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
|
6105 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
|
6106 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
|
6107 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
|
6108 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6109 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
|
6110 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6111 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
|
6112 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6113 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6114 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
|
6115 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
|
6116 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
|
6117 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6118 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6119 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
|
6120 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6121 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
|
6122 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
|
6123 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6124 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6125 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6126 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6127 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
|
6128 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6129 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6130 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
|
6131 /* 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
|
6132 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6133 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6134 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6135 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6136 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6137 } |
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
|
6138 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6139 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6140 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
|
6141 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
|
6142 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
|
6143 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6144 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6145 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
|
6146 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
|
6147 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
|
6148 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6149 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6150 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
|
6151 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6152 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6153 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6154 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6155 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
|
6156 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
|
6157 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6158 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6159 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
6160 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
|
6161 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6162 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
|
6163 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
|
6164 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
|
6165 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
|
6166 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
|
6167 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6168 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
|
6169 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6170 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
|
6171 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6172 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6173 int incy, incx; |
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 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6176 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6177 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
|
6178 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
|
6179 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6180 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6181 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6182 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
|
6183 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
|
6184 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6185 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6186 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6187 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6188 posy -= 0x10000L; |
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 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6191 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6192 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6193 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6194 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6195 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6196 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
|
6197 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6198 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6199 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
|
6200 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6201 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
|
6202 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
|
6203 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6204 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6205 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6206 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6207 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
|
6208 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6209 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6210 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
|
6211 /* 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
|
6212 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6213 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6214 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6215 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6216 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6217 } |
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
|
6218 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6219 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6220 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
|
6221 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
|
6222 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
|
6223 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6224 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6225 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
|
6226 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
|
6227 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
|
6228 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6229 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6230 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
|
6231 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6232 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6233 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6234 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6235 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6236 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
|
6237 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6238 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6239 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
6240 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
|
6241 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6242 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
|
6243 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6244 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
|
6245 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6246 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6247 int incy, incx; |
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 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6250 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6251 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
|
6252 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
|
6253 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6254 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6255 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6256 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
|
6257 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
|
6258 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6259 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6260 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6261 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6262 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6263 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6264 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6265 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6266 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6267 ++srcx; |
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 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6270 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
|
6271 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6272 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6273 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
|
6274 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
|
6275 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6276 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6277 ++dst; |
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 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6280 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
|
6281 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6282 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6283 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
6284 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
|
6285 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6286 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
|
6287 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6288 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
|
6289 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6290 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
|
6291 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6292 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6293 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
|
6294 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
|
6295 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
|
6296 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6297 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6298 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
|
6299 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6300 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
|
6301 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
|
6302 /* 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
|
6303 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6304 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6305 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6306 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6307 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6308 } |
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
|
6309 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6310 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6311 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
|
6312 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
|
6313 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
|
6314 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6315 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6316 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
|
6317 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
|
6318 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
|
6319 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6320 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6321 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
|
6322 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6323 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6324 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6325 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6326 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
|
6327 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
|
6328 } |
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 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
6331 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
|
6332 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6333 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
|
6334 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6335 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
|
6336 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6337 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
|
6338 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6339 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6340 int incy, incx; |
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 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6343 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6344 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
|
6345 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
|
6346 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6347 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6348 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6349 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
|
6350 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
|
6351 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6352 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6353 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6354 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6355 posy -= 0x10000L; |
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 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6358 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6359 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6360 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6361 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6362 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6363 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
|
6364 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6365 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6366 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
|
6367 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6368 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
|
6369 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
|
6370 /* 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
|
6371 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6372 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6373 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6374 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6375 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6376 } |
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
|
6377 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6378 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6379 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
|
6380 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
|
6381 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
|
6382 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6383 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6384 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
|
6385 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
|
6386 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
|
6387 break; |
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 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
|
6390 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6391 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6392 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6393 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6394 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6395 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
|
6396 } |
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 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
6399 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
|
6400 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6401 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
|
6402 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
|
6403 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
|
6404 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
|
6405 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
|
6406 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6407 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
|
6408 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6409 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6410 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
|
6411 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
|
6412 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
|
6413 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6414 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6415 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
|
6416 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
|
6417 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6418 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6419 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6420 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6421 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
|
6422 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6423 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6424 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
|
6425 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6426 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6427 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6428 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6429 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
|
6430 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
|
6431 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6432 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6433 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
6434 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
|
6435 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6436 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
|
6437 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
|
6438 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
|
6439 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
|
6440 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
|
6441 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6442 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
|
6443 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6444 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6445 int incy, incx; |
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 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6448 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6449 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
|
6450 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
|
6451 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6452 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6453 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6454 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
|
6455 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
|
6456 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6457 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6458 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6459 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6460 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6461 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6462 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6463 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6464 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6465 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6466 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6467 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6468 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
|
6469 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6470 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6471 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
|
6472 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
|
6473 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6474 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6475 B = (B * modulateB) / 255; |
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 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
|
6478 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6479 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6480 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
|
6481 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6482 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6483 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6484 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6485 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6486 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
|
6487 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6488 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6489 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
6490 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
|
6491 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6492 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
|
6493 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
|
6494 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
|
6495 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
|
6496 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
|
6497 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6498 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
|
6499 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6500 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
|
6501 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6502 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6503 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
|
6504 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
|
6505 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
|
6506 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6507 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6508 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
|
6509 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6510 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
|
6511 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
|
6512 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6513 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6514 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6515 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6516 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
|
6517 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6518 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6519 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
|
6520 /* 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
|
6521 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6522 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6523 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6524 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6525 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6526 } |
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
|
6527 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6528 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6529 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
|
6530 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
|
6531 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
|
6532 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6533 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6534 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
|
6535 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
|
6536 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
|
6537 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6538 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6539 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
|
6540 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6541 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6542 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6543 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6544 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
|
6545 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
|
6546 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6547 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6548 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
6549 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
|
6550 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6551 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
|
6552 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
|
6553 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
|
6554 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
|
6555 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
|
6556 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6557 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
|
6558 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6559 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
|
6560 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6561 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6562 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6563 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6564 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6565 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6566 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
|
6567 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
|
6568 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6569 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6570 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6571 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
|
6572 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
|
6573 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6574 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6575 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6576 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6577 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6578 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6579 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6580 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6581 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6582 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6583 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6584 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6585 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
|
6586 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6587 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6588 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
|
6589 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6590 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
|
6591 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
|
6592 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6593 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6594 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6595 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6596 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
|
6597 srcA = (srcA * modulateA) / 255; |
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 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
|
6600 /* 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
|
6601 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6602 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6603 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6604 srcB = (srcB * srcA) / 255; |
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 } |
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
|
6607 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6608 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6609 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
|
6610 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
|
6611 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
|
6612 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6613 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6614 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
|
6615 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
|
6616 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
|
6617 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6618 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6619 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
|
6620 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6621 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6622 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6623 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6624 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6625 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
|
6626 } |
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 |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6629 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
|
6630 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6631 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6632 Uint32 pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6633 Uint32 R, G, B, A; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6634 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6635 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6636 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6637 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6638 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6639 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6640 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
|
6641 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
|
6642 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6643 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6644 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6645 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6646 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6647 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6648 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6649 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6650 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6651 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6652 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6653 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6654 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6655 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6656 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6657 posx -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6658 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6659 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
|
6660 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6661 pixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6662 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
|
6663 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
|
6664 *dst = pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6665 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6666 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6667 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6668 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6669 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6670 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6671 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6672 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6673 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
|
6674 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6675 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6676 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6677 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6678 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6679 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6680 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6681 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6682 Uint32 *src = (Uint32 *)info->src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6683 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6684 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6685 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6686 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6687 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
|
6688 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6689 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
|
6690 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
|
6691 /* 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
|
6692 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6693 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6694 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6695 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6696 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6697 } |
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
|
6698 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6699 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6700 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
|
6701 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
|
6702 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
|
6703 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6704 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6705 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
|
6706 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
|
6707 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
|
6708 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6709 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6710 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
|
6711 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6712 ++src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6713 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6714 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6715 info->src += info->src_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6716 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6717 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6718 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6719 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6720 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
|
6721 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6722 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6723 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6724 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6725 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6726 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6727 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6728 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6729 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6730 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6731 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6732 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6733 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
|
6734 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
|
6735 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6736 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6737 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6738 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6739 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6740 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6741 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6742 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6743 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6744 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6745 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6746 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6747 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6748 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6749 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6750 posx -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6751 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6752 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
|
6753 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6754 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6755 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
|
6756 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6757 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
|
6758 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
|
6759 /* 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
|
6760 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6761 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6762 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6763 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6764 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6765 } |
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
|
6766 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6767 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6768 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
|
6769 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
|
6770 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
|
6771 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6772 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6773 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
|
6774 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
|
6775 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
|
6776 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6777 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6778 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
|
6779 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6780 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6781 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6782 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6783 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6784 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6785 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6786 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6787 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6788 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
|
6789 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6790 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6791 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6792 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6793 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6794 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6795 Uint32 pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6796 Uint32 R, G, B, A; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6797 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6798 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6799 Uint32 *src = (Uint32 *)info->src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6800 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6801 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6802 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6803 pixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6804 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
|
6805 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
|
6806 R = (R * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6807 G = (G * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6808 B = (B * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6809 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6810 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
|
6811 A = (A * modulateA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6812 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6813 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
|
6814 *dst = pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6815 ++src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6816 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6817 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6818 info->src += info->src_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6819 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6820 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6821 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6822 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6823 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
|
6824 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6825 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6826 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6827 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6828 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6829 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6830 Uint32 pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6831 Uint32 R, G, B, A; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6832 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6833 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6834 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6835 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6836 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6837 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6838 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
|
6839 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
|
6840 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6841 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6842 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6843 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6844 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6845 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6846 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6847 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6848 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6849 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6850 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6851 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6852 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6853 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6854 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6855 posx -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6856 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6857 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
|
6858 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6859 pixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6860 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
|
6861 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
|
6862 R = (R * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6863 G = (G * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6864 B = (B * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6865 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6866 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
|
6867 A = (A * modulateA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6868 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6869 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
|
6870 *dst = pixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6871 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6872 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6873 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6874 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6875 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6876 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6877 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6878 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6879 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
|
6880 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6881 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6882 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6883 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6884 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6885 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6886 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6887 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6888 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6889 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6890 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6891 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6892 Uint32 *src = (Uint32 *)info->src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6893 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6894 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6895 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6896 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6897 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
|
6898 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6899 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
|
6900 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
|
6901 srcR = (srcR * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6902 srcG = (srcG * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6903 srcB = (srcB * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6904 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6905 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
|
6906 srcA = (srcA * modulateA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6907 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6908 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
|
6909 /* 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
|
6910 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6911 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6912 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6913 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6914 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6915 } |
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
|
6916 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6917 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6918 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
|
6919 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
|
6920 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
|
6921 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6922 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6923 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
|
6924 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
|
6925 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
|
6926 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6927 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6928 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
|
6929 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6930 ++src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6931 ++dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6932 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6933 info->src += info->src_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6934 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6935 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6936 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6937 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6938 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
|
6939 { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6940 const int flags = info->flags; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6941 const Uint32 modulateR = info->r; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6942 const Uint32 modulateG = info->g; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6943 const Uint32 modulateB = info->b; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6944 const Uint32 modulateA = info->a; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6945 Uint32 srcpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6946 Uint32 srcR, srcG, srcB, srcA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6947 Uint32 dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6948 Uint32 dstR, dstG, dstB, dstA; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6949 int srcy, srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6950 int posy, posx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6951 int incy, incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6952 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6953 srcy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6954 posy = 0; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6955 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
|
6956 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
|
6957 |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6958 while (info->dst_h--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6959 Uint32 *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6960 Uint32 *dst = (Uint32 *)info->dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6961 int n = info->dst_w; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6962 srcx = -1; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6963 posx = 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6964 while (posy >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6965 ++srcy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6966 posy -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6967 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6968 while (n--) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6969 if (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6970 while (posx >= 0x10000L) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6971 ++srcx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6972 posx -= 0x10000L; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6973 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6974 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
|
6975 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6976 srcpixel = *src; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6977 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
|
6978 dstpixel = *dst; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6979 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
|
6980 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
|
6981 srcR = (srcR * modulateR) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6982 srcG = (srcG * modulateG) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6983 srcB = (srcB * modulateB) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6984 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6985 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
|
6986 srcA = (srcA * modulateA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6987 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6988 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
|
6989 /* 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
|
6990 if (srcA < 255) { |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6991 srcR = (srcR * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6992 srcG = (srcG * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6993 srcB = (srcB * srcA) / 255; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6994 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6995 } |
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
|
6996 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6997 case SDL_COPY_BLEND: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
6998 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
|
6999 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
|
7000 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
|
7001 break; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7002 case SDL_COPY_ADD: |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7003 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
|
7004 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
|
7005 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
|
7006 break; |
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 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
|
7009 *dst = dstpixel; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7010 posx += incx; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7011 ++dst; |
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 posy += incy; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7014 info->dst += info->dst_pitch; |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7015 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7016 } |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
7017 |
2267
c785543d1843
Okay, still some bugs, but everything builds again...
Sam Lantinga <slouken@libsdl.org>
parents:
2263
diff
changeset
|
7018 SDL_BlitFuncEntry SDL_GeneratedBlitFuncTable[] = { |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7019 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_RGB888_Scale }, |
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
|
7020 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_BLEND | SDL_COPY_ADD), SDL_CPU_ANY, SDL_Blit_RGB888_RGB888_Blend }, |
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
|
7021 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_BLEND | SDL_COPY_ADD | 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
|
7022 { 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
|
7023 { 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 }, |
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
|
7024 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD), SDL_CPU_ANY, SDL_Blit_RGB888_RGB888_Modulate_Blend }, |
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
|
7025 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | 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
|
7026 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_BGR888_Scale }, |
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
|
7027 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_BLEND | SDL_COPY_ADD), SDL_CPU_ANY, SDL_Blit_RGB888_BGR888_Blend }, |
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
|
7028 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_BLEND | SDL_COPY_ADD | 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
|
7029 { 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
|
7030 { 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 }, |
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
|
7031 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD), SDL_CPU_ANY, SDL_Blit_RGB888_BGR888_Modulate_Blend }, |
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
|
7032 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | 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
|
7033 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_ARGB8888_Scale }, |
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
|
7034 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_ADD), SDL_CPU_ANY, SDL_Blit_RGB888_ARGB8888_Blend }, |
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
|
7035 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_ADD | 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
|
7036 { 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
|
7037 { 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 }, |
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
|
7038 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD), SDL_CPU_ANY, SDL_Blit_RGB888_ARGB8888_Modulate_Blend }, |
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
|
7039 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | 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
|
7040 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Scale }, |
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
|
7041 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_BLEND | SDL_COPY_ADD), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Blend }, |
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
|
7042 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_BLEND | SDL_COPY_ADD | 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
|
7043 { 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
|
7044 { 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 }, |
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
|
7045 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Modulate_Blend }, |
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
|
7046 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | 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
|
7047 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_BGR888_Scale }, |
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
|
7048 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_BLEND | SDL_COPY_ADD), SDL_CPU_ANY, SDL_Blit_BGR888_BGR888_Blend }, |
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
|
7049 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_BLEND | SDL_COPY_ADD | 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
|
7050 { 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
|
7051 { 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 }, |
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
|
7052 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD), SDL_CPU_ANY, SDL_Blit_BGR888_BGR888_Modulate_Blend }, |
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
|
7053 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | 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
|
7054 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_ARGB8888_Scale }, |
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
|
7055 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_ADD), SDL_CPU_ANY, SDL_Blit_BGR888_ARGB8888_Blend }, |
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
|
7056 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_ADD | 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
|
7057 { 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
|
7058 { 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 }, |
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
|
7059 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD), SDL_CPU_ANY, SDL_Blit_BGR888_ARGB8888_Modulate_Blend }, |
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
|
7060 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | 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
|
7061 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Scale }, |
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
|
7062 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_BLEND | SDL_COPY_ADD), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Blend }, |
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
|
7063 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_BLEND | SDL_COPY_ADD | 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
|
7064 { 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
|
7065 { 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 }, |
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
|
7066 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Modulate_Blend }, |
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
|
7067 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | 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
|
7068 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_BGR888_Scale }, |
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
|
7069 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_BLEND | SDL_COPY_ADD), SDL_CPU_ANY, SDL_Blit_ARGB8888_BGR888_Blend }, |
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
|
7070 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_BLEND | SDL_COPY_ADD | 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
|
7071 { 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
|
7072 { 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 }, |
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
|
7073 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD), SDL_CPU_ANY, SDL_Blit_ARGB8888_BGR888_Modulate_Blend }, |
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
|
7074 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | 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
|
7075 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_ARGB8888_Scale }, |
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
|
7076 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_ADD), SDL_CPU_ANY, SDL_Blit_ARGB8888_ARGB8888_Blend }, |
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
|
7077 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_ADD | 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
|
7078 { 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
|
7079 { 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 }, |
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
|
7080 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD), SDL_CPU_ANY, SDL_Blit_ARGB8888_ARGB8888_Modulate_Blend }, |
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
|
7081 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | 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
|
7082 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Scale }, |
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
|
7083 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_BLEND | SDL_COPY_ADD), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Blend }, |
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
|
7084 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_BLEND | SDL_COPY_ADD | 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
|
7085 { 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
|
7086 { 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 }, |
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
|
7087 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Modulate_Blend }, |
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
|
7088 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | 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
|
7089 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_BGR888_Scale }, |
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
|
7090 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_BLEND | SDL_COPY_ADD), SDL_CPU_ANY, SDL_Blit_RGBA8888_BGR888_Blend }, |
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
|
7091 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_BLEND | SDL_COPY_ADD | 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
|
7092 { 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
|
7093 { 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 }, |
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
|
7094 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD), SDL_CPU_ANY, SDL_Blit_RGBA8888_BGR888_Modulate_Blend }, |
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
|
7095 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | 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
|
7096 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_ARGB8888_Scale }, |
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
|
7097 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_ADD), SDL_CPU_ANY, SDL_Blit_RGBA8888_ARGB8888_Blend }, |
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
|
7098 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_ADD | 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
|
7099 { 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
|
7100 { 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 }, |
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
|
7101 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD), SDL_CPU_ANY, SDL_Blit_RGBA8888_ARGB8888_Modulate_Blend }, |
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
|
7102 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | 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
|
7103 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Scale }, |
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
|
7104 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_BLEND | SDL_COPY_ADD), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Blend }, |
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
|
7105 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_BLEND | SDL_COPY_ADD | 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
|
7106 { 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
|
7107 { 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 }, |
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
|
7108 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Modulate_Blend }, |
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
|
7109 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | 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
|
7110 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_BGR888_Scale }, |
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
|
7111 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_BLEND | SDL_COPY_ADD), SDL_CPU_ANY, SDL_Blit_ABGR8888_BGR888_Blend }, |
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
|
7112 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_BLEND | SDL_COPY_ADD | 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
|
7113 { 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
|
7114 { 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 }, |
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
|
7115 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD), SDL_CPU_ANY, SDL_Blit_ABGR8888_BGR888_Modulate_Blend }, |
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
|
7116 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | 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
|
7117 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_ARGB8888_Scale }, |
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
|
7118 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_ADD), SDL_CPU_ANY, SDL_Blit_ABGR8888_ARGB8888_Blend }, |
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
|
7119 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_ADD | 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
|
7120 { 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
|
7121 { 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 }, |
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
|
7122 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD), SDL_CPU_ANY, SDL_Blit_ABGR8888_ARGB8888_Modulate_Blend }, |
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
|
7123 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | 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
|
7124 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Scale }, |
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
|
7125 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_BLEND | SDL_COPY_ADD), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Blend }, |
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
|
7126 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_BLEND | SDL_COPY_ADD | 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
|
7127 { 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
|
7128 { 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 }, |
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
|
7129 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Modulate_Blend }, |
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
|
7130 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | 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
|
7131 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_BGR888_Scale }, |
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
|
7132 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_BLEND | SDL_COPY_ADD), SDL_CPU_ANY, SDL_Blit_BGRA8888_BGR888_Blend }, |
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
|
7133 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_BLEND | SDL_COPY_ADD | 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
|
7134 { 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
|
7135 { 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 }, |
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
|
7136 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD), SDL_CPU_ANY, SDL_Blit_BGRA8888_BGR888_Modulate_Blend }, |
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
|
7137 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | 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
|
7138 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_ARGB8888_Scale }, |
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
|
7139 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_ADD), SDL_CPU_ANY, SDL_Blit_BGRA8888_ARGB8888_Blend }, |
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
|
7140 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_ADD | 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
|
7141 { 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
|
7142 { 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 }, |
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
|
7143 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD), SDL_CPU_ANY, SDL_Blit_BGRA8888_ARGB8888_Modulate_Blend }, |
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
|
7144 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | 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
|
7145 { 0, 0, 0, 0, NULL } |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7146 }; |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
7147 |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7148 /* *INDENT-ON* */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7149 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7150 /* vi: set ts=4 sw=4 expandtab: */ |