Mercurial > sdl-ios-xcode
annotate src/video/SDL_blit_auto.c @ 2630:776f7f800131 gsoc2008_force_feedback
Updating documentation about NumEffects and NumPlaying.
author | Edgar Simo <bobbens@gmail.com> |
---|---|
date | Wed, 06 Aug 2008 10:53:55 +0000 |
parents | c785543d1843 |
children | 8969da2ef606 |
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 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4 Copyright (C) 1997-2006 Sam Lantinga |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6 This library is free software; you can redistribute it and/or |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7 modify it under the terms of the GNU Lesser General Public |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
8 License as published by the Free Software Foundation; either |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
9 version 2.1 of the License, or (at your option) any later version. |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
10 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
11 This library is distributed in the hope that it will be useful, |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
12 but WITHOUT ANY WARRANTY; without even the implied warranty of |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
14 Lesser General Public License for more details. |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
15 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
16 You should have received a copy of the GNU Lesser General Public |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
17 License along with this library; if not, write to the Free Software |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
18 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
19 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
20 Sam Lantinga |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
21 slouken@libsdl.org |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
22 */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
23 #include "SDL_config.h" |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
24 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
25 /* *INDENT-OFF* */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
26 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
27 #include "SDL_video.h" |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
28 #include "SDL_blit.h" |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
29 #include "SDL_blit_auto.h" |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
30 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
31 static void SDL_Blit_RGB888_RGB888_Scale(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
32 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
33 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
34 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
35 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
36 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
37 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
38 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
39 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
40 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
41 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
42 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
43 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
44 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
45 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
46 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
47 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
48 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
49 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
50 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
51 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
52 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
53 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
54 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
55 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
56 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
57 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
58 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
59 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
60 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
61 *dst = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
62 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
63 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
64 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
65 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
66 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
67 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
68 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
69 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
70 static void SDL_Blit_RGB888_RGB888_Blend(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
71 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
72 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
73 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
74 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
75 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
76 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
77 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
78 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
79 Uint32 *src = (Uint32 *)info->src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
80 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
81 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
82 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
83 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
84 srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
85 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
86 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
87 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
88 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
89 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
90 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
91 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
92 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
93 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
94 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
95 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
96 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
97 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
98 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
99 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
100 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
101 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
102 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
103 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
104 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
105 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
106 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
107 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
108 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
109 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
110 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
111 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
112 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
113 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
114 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
115 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
116 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
117 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
118 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
119 dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
120 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
121 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
122 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
123 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
124 info->src += info->src_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
125 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
126 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
127 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
128 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
129 static void SDL_Blit_RGB888_RGB888_Blend_Scale(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
130 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
131 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
132 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
133 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
134 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
135 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
136 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
137 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
138 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
139 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
140 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
141 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
142 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
143 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
144 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
145 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
146 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
147 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
148 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
149 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
150 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
151 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
152 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
153 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
154 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
155 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
156 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
157 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
158 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
159 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
160 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
161 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
162 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
163 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
164 srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
165 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
166 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
167 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
168 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
169 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
170 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
171 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
172 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
173 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
174 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
175 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
176 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
177 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
178 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
179 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
180 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
181 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
182 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
183 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
184 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
185 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
186 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
187 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
188 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
189 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
190 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
191 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
192 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
193 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
194 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
195 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
196 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
197 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
198 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
199 dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
200 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
201 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
202 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
203 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
204 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
205 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
206 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
207 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
208 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
209 static void SDL_Blit_RGB888_RGB888_Modulate(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
210 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
211 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
212 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
213 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
214 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
215 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
216 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
217 Uint32 R, G, B, A; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
218 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
219 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
220 Uint32 *src = (Uint32 *)info->src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
221 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
222 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
223 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
224 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
225 R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; A = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
226 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
227 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
228 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
229 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
230 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
231 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
232 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
233 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
234 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
235 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
236 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
237 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
238 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
239 info->src += info->src_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
240 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
241 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
242 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
243 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
244 static void SDL_Blit_RGB888_RGB888_Modulate_Scale(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
245 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
246 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
247 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
248 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
249 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
250 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
251 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
252 Uint32 R, G, B, A; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
253 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
254 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
255 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
256 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
257 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
258 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
259 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
260 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
261 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
262 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
263 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
264 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
265 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
266 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
267 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
268 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
269 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
270 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
271 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
272 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
273 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
274 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
275 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
276 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
277 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
278 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
279 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
280 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
281 R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; A = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
282 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
283 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
284 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
285 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
286 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
287 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
288 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
289 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
290 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
291 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
292 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
293 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
294 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
295 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
296 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
297 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
298 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
299 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
300 static void SDL_Blit_RGB888_RGB888_Modulate_Blend(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
301 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
302 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
303 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
304 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
305 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
306 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
307 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
308 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
309 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
310 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
311 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
312 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
313 Uint32 *src = (Uint32 *)info->src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
314 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
315 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
316 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
317 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
318 srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
319 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
320 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
321 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
322 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
323 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
324 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
325 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
326 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
327 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
328 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
329 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
330 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
331 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
332 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
333 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
334 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
335 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
336 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
337 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
338 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
339 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
340 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
341 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
342 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
343 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
344 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
345 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
346 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
347 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
348 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
349 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
350 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
351 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
352 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
353 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
354 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
355 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
356 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
357 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
358 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
359 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
360 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
361 dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
362 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
363 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
364 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
365 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
366 info->src += info->src_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
367 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
368 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
369 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
370 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
371 static void SDL_Blit_RGB888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
372 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
373 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
374 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
375 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
376 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
377 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
378 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
379 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
380 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
381 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
382 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
383 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
384 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
385 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
386 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
387 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
388 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
389 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
390 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
391 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
392 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
393 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
394 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
395 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
396 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
397 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
398 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
399 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
400 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
401 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
402 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
403 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
404 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
405 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
406 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
407 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
408 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
409 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
410 srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
411 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
412 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
413 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
414 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
415 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
416 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
417 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
418 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
419 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
420 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
421 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
422 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
423 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
424 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
425 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
426 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
427 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
428 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
429 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
430 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
431 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
432 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
433 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
434 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
435 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
436 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
437 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
438 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
439 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
440 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
441 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
442 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
443 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
444 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
445 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
446 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
447 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
448 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
449 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
450 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
451 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
452 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
453 dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
454 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
455 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
456 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
457 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
458 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
459 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
460 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
461 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
462 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
463 static void SDL_Blit_RGB888_BGR888_Scale(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
464 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
465 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
466 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
467 Uint32 R, G, B, A; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
468 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
469 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
470 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
471 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
472 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
473 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
474 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
475 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
476 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
477 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
478 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
479 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
480 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
481 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
482 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
483 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
484 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
485 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
486 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
487 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
488 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
489 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
490 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
491 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
492 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
493 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
494 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
495 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
496 R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; A = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
497 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
498 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
499 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
500 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
501 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
502 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
503 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
504 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
505 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
506 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
507 static void SDL_Blit_RGB888_BGR888_Blend(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
508 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
509 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
510 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
511 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
512 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
513 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
514 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
515 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
516 Uint32 *src = (Uint32 *)info->src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
517 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
518 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
519 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
520 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
521 srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
522 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
523 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
524 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
525 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
526 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
527 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
528 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
529 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
530 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
531 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
532 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
533 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
534 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
535 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
536 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
537 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
538 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
539 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
540 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
541 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
542 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
543 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
544 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
545 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
546 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
547 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
548 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
549 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
550 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
551 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
552 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
553 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
554 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
555 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
556 dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
557 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
558 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
559 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
560 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
561 info->src += info->src_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
562 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
563 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
564 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
565 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
566 static void SDL_Blit_RGB888_BGR888_Blend_Scale(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
567 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
568 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
569 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
570 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
571 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
572 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
573 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
574 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
575 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
576 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
577 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
578 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
579 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
580 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
581 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
582 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
583 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
584 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
585 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
586 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
587 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
588 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
589 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
590 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
591 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
592 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
593 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
594 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
595 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
596 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
597 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
598 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
599 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
600 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
601 srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
602 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
603 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
604 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
605 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
606 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
607 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
608 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
609 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
610 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
611 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
612 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
613 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
614 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
615 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
616 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
617 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
618 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
619 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
620 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
621 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
622 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
623 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
624 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
625 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
626 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
627 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
628 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
629 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
630 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
631 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
632 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
633 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
634 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
635 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
636 dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
637 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
638 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
639 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
640 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
641 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
642 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
643 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
644 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
645 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
646 static void SDL_Blit_RGB888_BGR888_Modulate(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
647 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
648 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
649 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
650 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
651 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
652 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
653 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
654 Uint32 R, G, B, A; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
655 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
656 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
657 Uint32 *src = (Uint32 *)info->src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
658 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
659 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
660 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
661 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
662 R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; A = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
663 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
664 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
665 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
666 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
667 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
668 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
669 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
670 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
671 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
672 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
673 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
674 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
675 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
676 info->src += info->src_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
677 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
678 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
679 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
680 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
681 static void SDL_Blit_RGB888_BGR888_Modulate_Scale(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
682 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
683 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
684 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
685 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
686 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
687 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
688 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
689 Uint32 R, G, B, A; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
690 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
691 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
692 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
693 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
694 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
695 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
696 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
697 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
698 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
699 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
700 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
701 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
702 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
703 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
704 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
705 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
706 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
707 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
708 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
709 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
710 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
711 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
712 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
713 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
714 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
715 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
716 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
717 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
718 R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; A = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
719 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
720 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
721 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
722 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
723 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
724 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
725 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
726 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
727 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
728 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
729 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
730 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
731 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
732 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
733 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
734 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
735 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
736 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
737 static void SDL_Blit_RGB888_BGR888_Modulate_Blend(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
738 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
739 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
740 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
741 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
742 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
743 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
744 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
745 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
746 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
747 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
748 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
749 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
750 Uint32 *src = (Uint32 *)info->src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
751 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
752 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
753 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
754 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
755 srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
756 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
757 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
758 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
759 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
760 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
761 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
762 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
763 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
764 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
765 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
766 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
767 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
768 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
769 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
770 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
771 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
772 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
773 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
774 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
775 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
776 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
777 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
778 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
779 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
780 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
781 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
782 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
783 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
784 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
785 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
786 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
787 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
788 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
789 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
790 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
791 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
792 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
793 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
794 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
795 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
796 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
797 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
798 dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
799 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
800 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
801 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
802 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
803 info->src += info->src_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
804 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
805 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
806 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
807 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
808 static void SDL_Blit_RGB888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info) |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
809 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
810 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
811 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
812 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
813 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
814 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
815 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
816 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
817 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
818 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
819 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
820 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
821 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
822 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
823 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
824 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
825 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
826 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
827 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
828 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
829 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
830 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
831 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
832 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
833 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
834 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
835 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
836 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
837 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
838 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
839 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
840 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
841 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
842 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
843 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
844 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
845 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
846 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
847 srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
848 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
849 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
850 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
851 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
852 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
853 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
854 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
855 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
856 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
857 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
858 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
859 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
860 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
861 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
862 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
863 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
864 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
865 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
866 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
867 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
868 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
869 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
870 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
871 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
872 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
873 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
874 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
875 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
876 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
877 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
878 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
879 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
880 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
881 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
882 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
883 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
884 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
885 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
886 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
887 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
888 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
889 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
890 dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
891 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
892 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
893 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
894 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
895 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
896 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
897 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
898 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
899 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
900 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
|
901 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
902 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
|
903 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
904 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
|
905 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
906 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
907 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
908 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
909 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
910 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
911 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
|
912 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
|
913 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
914 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
915 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
916 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
|
917 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
|
918 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
919 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
920 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
921 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
922 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
923 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
924 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
925 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
926 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
927 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
928 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
929 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
930 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
|
931 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
932 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
933 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
|
934 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
|
935 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
936 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
937 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
938 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
939 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
940 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
|
941 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
942 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
943 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
944 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
|
945 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
946 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
|
947 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
948 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
|
949 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
950 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
|
951 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
952 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
953 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
|
954 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
|
955 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
|
956 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
957 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
958 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
|
959 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
960 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
|
961 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
|
962 /* 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
|
963 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
964 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
965 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
966 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
967 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
968 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
969 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
970 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
971 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
972 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
973 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
974 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
975 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
976 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
977 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
978 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
|
979 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
|
980 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
|
981 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
982 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
983 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
|
984 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
|
985 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
|
986 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
987 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
988 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
989 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
990 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
991 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
992 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
993 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
|
994 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
995 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
996 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
997 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
998 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
|
999 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
|
1000 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1001 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1002 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
1003 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
|
1004 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1005 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
|
1006 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1007 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
|
1008 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1009 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
|
1010 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1011 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1012 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1013 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1014 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1015 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1016 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
|
1017 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
|
1018 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1019 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1020 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1021 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
|
1022 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
|
1023 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1024 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1025 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1026 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1027 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1028 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1029 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1030 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1031 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1032 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1033 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1034 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1035 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
|
1036 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1037 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1038 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
|
1039 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1040 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
|
1041 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
|
1042 /* 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
|
1043 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1044 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1045 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1046 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1047 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1048 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1049 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1050 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1051 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1052 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1053 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1054 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1055 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1056 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1057 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1058 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
|
1059 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
|
1060 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
|
1061 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1062 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1063 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
|
1064 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
|
1065 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
|
1066 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1067 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1068 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1069 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1070 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1071 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1072 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1073 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
|
1074 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1075 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1076 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1077 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1078 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1079 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
|
1080 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1081 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1082 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
1083 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
|
1084 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1085 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
|
1086 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
|
1087 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
|
1088 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
|
1089 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
|
1090 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1091 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
|
1092 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1093 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1094 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
|
1095 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
|
1096 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
|
1097 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1098 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1099 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
|
1100 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
|
1101 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1102 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1103 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1104 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1105 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
|
1106 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1107 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1108 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
|
1109 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1110 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1111 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1112 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1113 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
|
1114 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
|
1115 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1116 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1117 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
1118 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
|
1119 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1120 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
|
1121 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
|
1122 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
|
1123 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
|
1124 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
|
1125 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1126 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
|
1127 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1128 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1129 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1130 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1131 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1132 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1133 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
|
1134 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
|
1135 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1136 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1137 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1138 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
|
1139 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
|
1140 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1141 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1142 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1143 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1144 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1145 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1146 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1147 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1148 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1149 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1150 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1151 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1152 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
|
1153 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1154 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1155 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
|
1156 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
|
1157 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1158 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1159 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1160 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1161 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
|
1162 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1163 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1164 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
|
1165 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1166 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1167 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1168 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1169 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1170 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
|
1171 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1172 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1173 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
1174 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
|
1175 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1176 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
|
1177 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
|
1178 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
|
1179 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
|
1180 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
|
1181 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1182 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
|
1183 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1184 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
|
1185 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1186 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1187 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
|
1188 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
|
1189 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
|
1190 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1191 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1192 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
|
1193 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1194 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
|
1195 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
|
1196 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1197 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1198 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1199 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1200 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
|
1201 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1202 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1203 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
|
1204 /* 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
|
1205 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1206 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1207 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1208 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1209 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1210 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1211 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1212 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1213 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1214 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1215 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1216 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1217 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1218 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1219 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1220 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
|
1221 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
|
1222 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
|
1223 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1224 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1225 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
|
1226 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
|
1227 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
|
1228 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1229 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1230 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1231 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1232 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1233 break; |
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 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
|
1236 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1237 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1238 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1239 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1240 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
|
1241 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
|
1242 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1243 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1244 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
1245 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
|
1246 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1247 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
|
1248 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
|
1249 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
|
1250 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
|
1251 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
|
1252 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1253 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
|
1254 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1255 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
|
1256 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1257 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1258 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1259 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1260 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1261 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1262 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
|
1263 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
|
1264 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1265 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1266 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1267 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
|
1268 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
|
1269 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1270 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1271 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1272 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1273 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1274 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1275 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1276 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1277 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1278 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1279 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1280 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1281 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
|
1282 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1283 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1284 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
|
1285 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1286 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
|
1287 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
|
1288 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1289 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1290 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1291 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1292 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
|
1293 srcA = (srcA * modulateA) / 255; |
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 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
|
1296 /* 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
|
1297 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1298 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1299 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1300 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1301 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1302 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1303 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1304 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1305 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1306 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1307 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1308 dstB = srcB; |
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 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1311 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1312 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
|
1313 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
|
1314 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
|
1315 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1316 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1317 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
|
1318 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
|
1319 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
|
1320 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1321 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1322 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1323 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1324 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1325 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1326 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1327 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
|
1328 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1329 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1330 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1331 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1332 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1333 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
|
1334 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1335 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1336 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
1337 static void SDL_Blit_BGR888_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
|
1338 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1339 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1340 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1341 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1342 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1343 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1344 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1345 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1346 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
|
1347 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
|
1348 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1349 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1350 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1351 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
|
1352 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
|
1353 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1354 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1355 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1356 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1357 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1358 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1359 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1360 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1361 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1362 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1363 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1364 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1365 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
|
1366 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1367 *dst = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1368 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1369 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1370 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1371 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1372 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
|
1373 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1374 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1375 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
1376 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
|
1377 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1378 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
|
1379 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1380 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
|
1381 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1382 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
|
1383 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1384 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1385 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
|
1386 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
|
1387 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
|
1388 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1389 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1390 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
|
1391 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1392 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
|
1393 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
|
1394 /* 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
|
1395 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1396 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1397 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1398 srcB = (srcB * srcA) / 255; |
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 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1401 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1402 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1403 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1404 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1405 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1406 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1407 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1408 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1409 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1410 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
|
1411 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
|
1412 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
|
1413 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1414 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1415 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
|
1416 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
|
1417 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
|
1418 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1419 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1420 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1421 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1422 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1423 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1424 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1425 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
|
1426 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1427 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1428 ++dst; |
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 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
|
1431 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
|
1432 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1433 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1434 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
1435 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
|
1436 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1437 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
|
1438 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1439 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
|
1440 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1441 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
|
1442 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1443 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1444 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1445 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1446 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1447 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1448 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
|
1449 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
|
1450 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1451 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1452 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1453 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
|
1454 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
|
1455 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1456 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1457 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1458 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1459 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1460 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1461 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1462 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1463 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1464 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1465 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1466 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1467 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
|
1468 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1469 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1470 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
|
1471 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1472 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
|
1473 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
|
1474 /* 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
|
1475 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1476 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1477 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1478 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1479 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1480 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1481 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1482 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1483 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1484 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1485 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1486 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1487 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1488 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1489 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1490 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
|
1491 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
|
1492 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
|
1493 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1494 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1495 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
|
1496 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
|
1497 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
|
1498 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1499 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1500 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1501 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1502 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1503 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1504 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1505 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
|
1506 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1507 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1508 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1509 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1510 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1511 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
|
1512 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1513 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1514 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
1515 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
|
1516 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1517 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
|
1518 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
|
1519 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
|
1520 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
|
1521 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
|
1522 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1523 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
|
1524 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1525 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1526 Uint32 *src = (Uint32 *)info->src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1527 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1528 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1529 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1530 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1531 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
|
1532 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
|
1533 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1534 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1535 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1536 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1537 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1538 A = (A * modulateA) / 255; |
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 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
|
1541 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1542 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1543 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1544 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1545 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
|
1546 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
|
1547 } |
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 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
1550 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
|
1551 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1552 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
|
1553 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
|
1554 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
|
1555 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
|
1556 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
|
1557 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1558 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
|
1559 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1560 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1561 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1562 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1563 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1564 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1565 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
|
1566 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
|
1567 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1568 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1569 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1570 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
|
1571 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
|
1572 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1573 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1574 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1575 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1576 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1577 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1578 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1579 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1580 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1581 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1582 posx -= 0x10000L; |
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 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
|
1585 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1586 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1587 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
|
1588 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
|
1589 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1590 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1591 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1592 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1593 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1594 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1595 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1596 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
|
1597 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1598 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1599 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1600 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1601 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1602 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
|
1603 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1604 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1605 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
1606 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
|
1607 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1608 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
|
1609 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
|
1610 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
|
1611 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
|
1612 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
|
1613 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1614 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
|
1615 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1616 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
|
1617 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1618 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1619 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
|
1620 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
|
1621 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
|
1622 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1623 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1624 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
|
1625 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1626 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
|
1627 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
|
1628 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1629 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1630 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1631 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1632 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1633 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1634 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1635 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
|
1636 /* 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
|
1637 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1638 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1639 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1640 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1641 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1642 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1643 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1644 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1645 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1646 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1647 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1648 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1649 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1650 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1651 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1652 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
|
1653 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
|
1654 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
|
1655 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1656 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1657 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
|
1658 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
|
1659 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
|
1660 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1661 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1662 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1663 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1664 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1665 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1666 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1667 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
|
1668 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1669 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1670 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1671 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1672 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
|
1673 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
|
1674 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1675 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1676 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
1677 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
|
1678 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1679 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
|
1680 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
|
1681 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
|
1682 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
|
1683 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
|
1684 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1685 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
|
1686 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1687 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
|
1688 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1689 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1690 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1691 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1692 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1693 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1694 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
|
1695 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
|
1696 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1697 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1698 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1699 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
|
1700 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
|
1701 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1702 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1703 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1704 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1705 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1706 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1707 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1708 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1709 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1710 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1711 posx -= 0x10000L; |
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 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
|
1714 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1715 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1716 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
|
1717 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1718 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
|
1719 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
|
1720 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1721 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1722 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1723 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1724 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1725 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1726 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1727 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
|
1728 /* 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
|
1729 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1730 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1731 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1732 srcB = (srcB * srcA) / 255; |
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 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1736 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1737 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1738 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1739 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1740 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1741 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1742 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1743 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1744 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
|
1745 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
|
1746 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
|
1747 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1748 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1749 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
|
1750 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
|
1751 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
|
1752 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1753 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1754 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1755 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1756 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1757 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1758 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1759 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
|
1760 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1761 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1762 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1763 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1764 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1765 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
|
1766 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1767 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1768 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
1769 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
|
1770 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1771 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
|
1772 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1773 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
|
1774 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1775 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1776 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1777 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1778 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1779 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1780 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
|
1781 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
|
1782 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1783 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1784 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1785 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
|
1786 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
|
1787 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1788 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1789 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1790 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1791 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1792 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1793 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1794 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1795 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1796 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1797 posx -= 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 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
|
1800 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1801 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1802 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
|
1803 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
|
1804 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1805 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1806 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1807 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1808 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1809 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1810 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1811 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1812 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
1813 static void SDL_Blit_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
|
1814 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1815 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1816 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1817 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1818 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1819 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1820 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1821 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1822 Uint32 *src = (Uint32 *)info->src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1823 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1824 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1825 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1826 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1827 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
|
1828 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1829 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
|
1830 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1831 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1832 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1833 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1834 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1835 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1836 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1837 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1838 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1839 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1840 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1841 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1842 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1843 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1844 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1845 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1846 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1847 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1848 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1849 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1850 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1851 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1852 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1853 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1854 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1855 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1856 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1857 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1858 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1859 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1860 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1861 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1862 dstpixel = ((Uint32)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
|
1863 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1864 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1865 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1866 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1867 info->src += info->src_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1868 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1869 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1870 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1871 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
1872 static void SDL_Blit_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
|
1873 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1874 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1875 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1876 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1877 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1878 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1879 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1880 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1881 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1882 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1883 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1884 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1885 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1886 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1887 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1888 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1889 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1890 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1891 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1892 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1893 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1894 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1895 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1896 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1897 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1898 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1899 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1900 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1901 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1902 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1903 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1904 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1905 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1906 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1907 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
|
1908 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1909 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
|
1910 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1911 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1912 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1913 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1914 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1915 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1916 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1917 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1918 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1919 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1920 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1921 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1922 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1923 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1924 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1925 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1926 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1927 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1928 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1929 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1930 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1931 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1932 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1933 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1934 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1935 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1936 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1937 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1938 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1939 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1940 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1941 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1942 dstpixel = ((Uint32)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
|
1943 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1944 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1945 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1946 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1947 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1948 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1949 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1950 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1951 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
1952 static void SDL_Blit_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
|
1953 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1954 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1955 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1956 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1957 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1958 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1959 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1960 Uint32 R, G, B, A; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1961 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1962 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1963 Uint32 *src = (Uint32 *)info->src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1964 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1965 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1966 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1967 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1968 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
|
1969 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1970 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1971 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1972 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1973 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1974 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1975 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1976 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1977 pixel = ((Uint32)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
|
1978 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1979 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1980 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1981 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1982 info->src += info->src_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1983 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1984 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1985 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1986 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
1987 static void SDL_Blit_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
|
1988 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1989 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1990 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1991 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1992 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1993 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1994 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1995 Uint32 R, G, B, A; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1996 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1997 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1998 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1999 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2000 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2001 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2002 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2003 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2004 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2005 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2006 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2007 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2008 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2009 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2010 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2011 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2012 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2013 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2014 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2015 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2016 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2017 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2018 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2019 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2020 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2021 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2022 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2023 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2024 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
|
2025 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2026 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2027 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2028 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2029 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2030 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2031 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2032 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2033 pixel = ((Uint32)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
|
2034 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2035 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2036 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2037 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2038 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2039 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2040 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2041 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2042 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
2043 static void SDL_Blit_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
|
2044 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2045 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2046 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2047 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2048 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2049 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2050 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2051 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2052 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2053 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2054 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2055 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2056 Uint32 *src = (Uint32 *)info->src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2057 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2058 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2059 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2060 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2061 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
|
2062 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2063 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
|
2064 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2065 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2066 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2067 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2068 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2069 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2070 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2071 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2072 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2073 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2074 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2075 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2076 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2077 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2078 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2079 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2080 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2081 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2082 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2083 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2084 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2085 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2086 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2087 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2088 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2089 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2090 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2091 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2092 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2093 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2094 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2095 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2096 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2097 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2098 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2099 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2100 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2101 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2102 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2103 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2104 dstpixel = ((Uint32)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
|
2105 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2106 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2107 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2108 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2109 info->src += info->src_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2110 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2111 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2112 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2113 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
2114 static void SDL_Blit_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
|
2115 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2116 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2117 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2118 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2119 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2120 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2121 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2122 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2123 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2124 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2125 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2126 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2127 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2128 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2129 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2130 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2131 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2132 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2133 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2134 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2135 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2136 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2137 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2138 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2139 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2140 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2141 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2142 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2143 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2144 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2145 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2146 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2147 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2148 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2149 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2150 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2151 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2152 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2153 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
|
2154 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2155 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
|
2156 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2157 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2158 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2159 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2160 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2161 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2162 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2163 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2164 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2165 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2166 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2167 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2168 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2169 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2170 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2171 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2172 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2173 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2174 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2175 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2176 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2177 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2178 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2179 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2180 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2181 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2182 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2183 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2184 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2185 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2186 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2187 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2188 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2189 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2190 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2191 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2192 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2193 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2194 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2195 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2196 dstpixel = ((Uint32)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
|
2197 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2198 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2199 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2200 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2201 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2202 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2203 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2204 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2205 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
2206 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
|
2207 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2208 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
|
2209 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2210 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
|
2211 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2212 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2213 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2214 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2215 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2216 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2217 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
|
2218 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
|
2219 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2220 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2221 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2222 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
|
2223 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
|
2224 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2225 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2226 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2227 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2228 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2229 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2230 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2231 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2232 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2233 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2234 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2235 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2236 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
|
2237 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2238 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2239 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
|
2240 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
|
2241 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2242 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2243 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2244 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2245 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2246 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
|
2247 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2248 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2249 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
2250 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
|
2251 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2252 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
|
2253 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2254 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
|
2255 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2256 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
|
2257 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2258 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2259 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
|
2260 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
|
2261 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
|
2262 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2263 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2264 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
|
2265 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2266 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
|
2267 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
|
2268 /* 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
|
2269 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2270 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2271 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2272 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2273 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2274 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2275 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2276 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2277 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2278 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2279 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2280 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2281 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2282 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2283 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2284 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
|
2285 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
|
2286 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
|
2287 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2288 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2289 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
|
2290 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
|
2291 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
|
2292 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2293 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2294 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2295 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2296 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2297 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2298 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2299 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
|
2300 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2301 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2302 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2303 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2304 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
|
2305 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
|
2306 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2307 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2308 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
2309 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
|
2310 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2311 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
|
2312 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2313 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
|
2314 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2315 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
|
2316 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2317 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2318 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2319 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2320 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2321 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2322 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
|
2323 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
|
2324 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2325 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2326 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2327 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
|
2328 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
|
2329 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2330 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2331 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2332 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2333 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2334 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2335 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2336 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2337 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2338 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2339 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2340 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2341 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
|
2342 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2343 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2344 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
|
2345 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2346 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
|
2347 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
|
2348 /* 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
|
2349 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2350 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2351 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2352 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2353 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2354 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2355 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2356 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2357 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2358 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2359 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2360 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2361 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2362 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2363 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2364 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
|
2365 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
|
2366 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
|
2367 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2368 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2369 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
|
2370 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
|
2371 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
|
2372 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2373 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2374 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2375 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2376 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2377 break; |
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 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
|
2380 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2381 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2382 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2383 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2384 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2385 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
|
2386 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2387 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2388 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
2389 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
|
2390 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2391 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
|
2392 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
|
2393 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
|
2394 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
|
2395 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
|
2396 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2397 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
|
2398 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2399 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2400 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
|
2401 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
|
2402 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
|
2403 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2404 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2405 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
|
2406 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
|
2407 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2408 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2409 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2410 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2411 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
|
2412 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2413 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2414 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
|
2415 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2416 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2417 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2418 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2419 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
|
2420 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
|
2421 } |
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 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
2424 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
|
2425 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2426 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
|
2427 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
|
2428 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
|
2429 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
|
2430 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
|
2431 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2432 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
|
2433 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2434 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2435 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2436 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2437 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2438 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2439 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
|
2440 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
|
2441 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2442 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2443 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2444 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
|
2445 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
|
2446 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2447 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2448 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2449 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2450 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2451 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2452 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2453 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2454 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2455 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2456 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2457 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2458 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
|
2459 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2460 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2461 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
|
2462 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
|
2463 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2464 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2465 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2466 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2467 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
|
2468 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2469 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2470 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
|
2471 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2472 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2473 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2474 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2475 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2476 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
|
2477 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2478 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2479 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
2480 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
|
2481 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2482 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
|
2483 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
|
2484 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
|
2485 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
|
2486 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
|
2487 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2488 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
|
2489 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2490 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
|
2491 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2492 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2493 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
|
2494 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
|
2495 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
|
2496 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2497 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2498 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
|
2499 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2500 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
|
2501 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
|
2502 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2503 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2504 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2505 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2506 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
|
2507 srcA = (srcA * modulateA) / 255; |
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 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
|
2510 /* 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
|
2511 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2512 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2513 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2514 srcB = (srcB * srcA) / 255; |
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 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2517 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2518 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2519 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2520 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2521 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2522 dstB = srcB; |
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 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2525 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2526 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
|
2527 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
|
2528 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
|
2529 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2530 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2531 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
|
2532 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
|
2533 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
|
2534 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2535 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2536 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2537 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2538 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2539 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2540 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2541 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
|
2542 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2543 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2544 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2545 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2546 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
|
2547 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
|
2548 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2549 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2550 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
2551 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
|
2552 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2553 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
|
2554 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
|
2555 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
|
2556 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
|
2557 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
|
2558 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2559 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
|
2560 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2561 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
|
2562 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2563 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2564 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2565 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2566 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2567 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2568 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
|
2569 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
|
2570 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2571 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2572 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2573 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
|
2574 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
|
2575 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2576 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2577 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2578 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2579 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2580 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2581 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2582 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2583 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2584 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2585 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2586 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2587 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
|
2588 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2589 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2590 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
|
2591 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2592 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
|
2593 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
|
2594 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2595 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2596 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2597 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2598 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
|
2599 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2600 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2601 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
|
2602 /* 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
|
2603 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2604 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2605 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2606 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2607 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2608 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2609 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2610 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2611 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2612 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2613 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2614 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2615 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2616 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2617 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2618 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
|
2619 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
|
2620 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
|
2621 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2622 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2623 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
|
2624 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
|
2625 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
|
2626 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2627 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2628 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2629 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2630 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2631 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2632 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2633 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
|
2634 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2635 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2636 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2637 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2638 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2639 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
|
2640 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2641 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2642 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
2643 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
|
2644 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2645 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2646 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2647 Uint32 R, G, B, A; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2648 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2649 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2650 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2651 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2652 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2653 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2654 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2655 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2656 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2657 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2658 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2659 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2660 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2661 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2662 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2663 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2664 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2665 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2666 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2667 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2668 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2669 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2670 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2671 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2672 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2673 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2674 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2675 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2676 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
|
2677 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2678 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2679 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2680 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2681 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2682 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2683 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2684 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2685 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2686 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
2687 static void SDL_Blit_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
|
2688 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2689 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2690 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2691 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2692 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2693 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2694 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2695 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2696 Uint32 *src = (Uint32 *)info->src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2697 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2698 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2699 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2700 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2701 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
|
2702 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2703 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2704 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2705 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2706 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2707 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2708 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2709 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2710 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2711 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2712 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2713 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2714 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2715 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2716 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2717 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2718 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2719 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2720 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2721 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2722 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2723 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2724 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2725 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2726 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2727 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2728 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2729 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2730 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2731 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2732 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2733 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2734 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2735 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2736 dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2737 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2738 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2739 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2740 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2741 info->src += info->src_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2742 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2743 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2744 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2745 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
2746 static void SDL_Blit_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
|
2747 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2748 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2749 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2750 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2751 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2752 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2753 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2754 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2755 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2756 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2757 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2758 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2759 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2760 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2761 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2762 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2763 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2764 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2765 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2766 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2767 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2768 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2769 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2770 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2771 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2772 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2773 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2774 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2775 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2776 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2777 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2778 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2779 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2780 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2781 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
|
2782 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2783 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2784 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2785 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2786 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2787 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2788 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2789 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2790 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2791 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2792 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2793 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2794 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2795 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2796 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2797 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2798 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2799 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2800 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2801 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2802 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2803 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2804 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2805 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2806 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2807 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2808 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2809 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2810 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2811 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2812 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2813 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2814 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2815 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2816 dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2817 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2818 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2819 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2820 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2821 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2822 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2823 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2824 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2825 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
2826 static void SDL_Blit_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
|
2827 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2828 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2829 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2830 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2831 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2832 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2833 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2834 Uint32 R, G, B, A; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2835 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2836 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2837 Uint32 *src = (Uint32 *)info->src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2838 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2839 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2840 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2841 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2842 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
|
2843 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2844 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2845 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2846 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2847 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2848 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2849 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2850 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2851 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2852 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2853 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2854 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2855 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2856 info->src += info->src_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2857 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2858 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2859 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2860 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
2861 static void SDL_Blit_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
|
2862 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2863 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2864 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2865 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2866 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2867 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2868 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2869 Uint32 R, G, B, A; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2870 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2871 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2872 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2873 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2874 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2875 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2876 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2877 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2878 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2879 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2880 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2881 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2882 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2883 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2884 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2885 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2886 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2887 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2888 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2889 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2890 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2891 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2892 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2893 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2894 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2895 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2896 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2897 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2898 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
|
2899 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2900 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2901 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2902 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2903 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2904 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2905 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2906 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2907 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2908 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2909 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2910 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2911 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2912 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2913 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2914 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2915 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2916 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
2917 static void SDL_Blit_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
|
2918 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2919 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2920 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2921 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2922 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2923 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2924 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2925 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2926 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2927 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2928 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2929 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2930 Uint32 *src = (Uint32 *)info->src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2931 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2932 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2933 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2934 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2935 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
|
2936 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2937 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2938 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2939 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2940 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2941 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2942 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2943 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2944 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2945 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2946 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2947 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2948 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2949 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2950 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2951 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2952 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2953 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2954 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2955 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2956 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2957 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2958 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2959 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2960 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2961 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2962 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2963 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2964 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2965 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2966 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2967 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2968 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2969 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2970 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2971 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2972 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2973 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2974 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2975 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2976 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2977 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2978 dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2979 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2980 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2981 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2982 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2983 info->src += info->src_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2984 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2985 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2986 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2987 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
2988 static void SDL_Blit_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
|
2989 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2990 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2991 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2992 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2993 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2994 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2995 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2996 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2997 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2998 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2999 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3000 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3001 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3002 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3003 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3004 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3005 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3006 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3007 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3008 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3009 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3010 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3011 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3012 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3013 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3014 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3015 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3016 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3017 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3018 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3019 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3020 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3021 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3022 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3023 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3024 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3025 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3026 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3027 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
|
3028 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3029 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3030 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3031 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3032 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3033 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3034 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3035 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3036 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3037 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3038 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3039 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3040 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3041 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3042 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3043 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3044 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3045 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3046 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3047 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3048 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3049 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3050 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3051 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3052 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3053 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3054 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3055 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3056 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3057 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3058 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3059 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3060 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3061 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3062 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3063 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3064 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3065 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3066 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3067 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3068 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3069 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3070 dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3071 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3072 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3073 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3074 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3075 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3076 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3077 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3078 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3079 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
3080 static void SDL_Blit_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
|
3081 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3082 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3083 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3084 Uint32 R, G, B, A; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3085 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3086 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3087 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3088 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3089 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3090 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3091 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3092 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3093 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3094 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3095 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3096 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3097 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3098 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3099 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3100 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3101 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3102 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3103 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3104 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3105 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3106 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3107 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3108 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3109 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3110 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3111 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3112 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3113 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
|
3114 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3115 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3116 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3117 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3118 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3119 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3120 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3121 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3122 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3123 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
3124 static void SDL_Blit_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
|
3125 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3126 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3127 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3128 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3129 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3130 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3131 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3132 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3133 Uint32 *src = (Uint32 *)info->src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3134 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3135 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3136 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3137 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3138 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
|
3139 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3140 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3141 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3142 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3143 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3144 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3145 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3146 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3147 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3148 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3149 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3150 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3151 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3152 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3153 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3154 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3155 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3156 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3157 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3158 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3159 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3160 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3161 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3162 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3163 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3164 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3165 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3166 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3167 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3168 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3169 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3170 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3171 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3172 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3173 dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3174 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3175 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3176 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3177 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3178 info->src += info->src_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3179 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3180 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3181 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3182 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
3183 static void SDL_Blit_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
|
3184 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3185 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3186 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3187 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3188 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3189 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3190 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3191 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3192 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3193 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3194 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3195 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3196 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3197 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3198 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3199 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3200 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3201 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3202 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3203 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3204 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3205 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3206 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3207 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3208 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3209 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3210 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3211 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3212 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3213 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3214 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3215 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3216 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3217 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3218 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
|
3219 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3220 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3221 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3222 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3223 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3224 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3225 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3226 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3227 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3228 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3229 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3230 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3231 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3232 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3233 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3234 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3235 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3236 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3237 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3238 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3239 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3240 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3241 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3242 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3243 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3244 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3245 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3246 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3247 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3248 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3249 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3250 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3251 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3252 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3253 dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3254 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3255 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3256 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3257 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3258 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3259 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3260 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3261 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3262 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
3263 static void SDL_Blit_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
|
3264 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3265 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3266 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3267 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3268 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3269 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3270 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3271 Uint32 R, G, B, A; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3272 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3273 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3274 Uint32 *src = (Uint32 *)info->src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3275 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3276 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3277 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3278 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3279 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
|
3280 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3281 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3282 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3283 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3284 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3285 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3286 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3287 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3288 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3289 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3290 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3291 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3292 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3293 info->src += info->src_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3294 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3295 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3296 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3297 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
3298 static void SDL_Blit_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
|
3299 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3300 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3301 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3302 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3303 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3304 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3305 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3306 Uint32 R, G, B, A; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3307 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3308 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3309 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3310 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3311 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3312 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3313 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3314 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3315 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3316 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3317 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3318 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3319 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3320 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3321 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3322 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3323 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3324 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3325 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3326 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3327 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3328 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3329 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3330 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3331 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3332 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3333 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3334 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3335 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
|
3336 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3337 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3338 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3339 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3340 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3341 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3342 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3343 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3344 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3345 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3346 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3347 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3348 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3349 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3350 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3351 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3352 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3353 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
3354 static void SDL_Blit_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
|
3355 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3356 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3357 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3358 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3359 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3360 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3361 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3362 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3363 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3364 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3365 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3366 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3367 Uint32 *src = (Uint32 *)info->src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3368 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3369 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3370 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3371 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3372 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
|
3373 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3374 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3375 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3376 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3377 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3378 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3379 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3380 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3381 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3382 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3383 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3384 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3385 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3386 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3387 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3388 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3389 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3390 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3391 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3392 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3393 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3394 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3395 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3396 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3397 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3398 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3399 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3400 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3401 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3402 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3403 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3404 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3405 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3406 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3407 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3408 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3409 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3410 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3411 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3412 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3413 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3414 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3415 dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3416 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3417 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3418 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3419 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3420 info->src += info->src_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3421 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3422 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3423 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3424 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
3425 static void SDL_Blit_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
|
3426 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3427 const int flags = info->flags; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3428 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3429 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3430 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3431 const Uint32 modulateA = info->a; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3432 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3433 Uint32 srcR, srcG, srcB, srcA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3434 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3435 Uint32 dstR, dstG, dstB, dstA; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3436 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3437 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3438 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3439 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3440 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3441 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3442 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3443 incx = (info->src_w << 16) / info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3444 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3445 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3446 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3447 Uint32 *dst = (Uint32 *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3448 int n = info->dst_w; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3449 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3450 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3451 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3452 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3453 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3454 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3455 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3456 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3457 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3458 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3459 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3460 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3461 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3462 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3463 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3464 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
|
3465 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3466 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3467 if (flags & SDL_COPY_MODULATE_COLOR) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3468 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3469 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3470 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3471 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3472 if (flags & SDL_COPY_MODULATE_ALPHA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3473 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3474 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3475 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3476 /* This goes away if we ever use premultiplied alpha */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3477 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3478 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3479 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3480 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3481 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3482 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3483 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3484 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3485 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3486 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3487 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3488 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3489 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3490 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3491 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3492 dstR = srcR + ((255 - srcA) * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3493 dstG = srcG + ((255 - srcA) * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3494 dstB = srcB + ((255 - srcA) * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3495 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3496 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3497 dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3498 dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3499 dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3500 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3501 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3502 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3503 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3504 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3505 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3506 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3507 dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3508 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3509 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3510 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3511 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3512 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3513 info->dst += info->dst_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3514 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3515 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3516 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
3517 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
|
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 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
|
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_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
|
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 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
|
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 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3586 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3587 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3588 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3589 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3590 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3591 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3592 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3593 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3594 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3595 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
|
3596 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
|
3597 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
|
3598 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3599 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3600 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
|
3601 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
|
3602 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
|
3603 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3604 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3605 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3606 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3607 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3608 break; |
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 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
|
3611 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3612 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3613 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3614 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3615 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
|
3616 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
|
3617 } |
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 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
3620 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
|
3621 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3622 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
|
3623 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3624 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
|
3625 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3626 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
|
3627 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3628 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3629 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3630 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3631 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3632 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3633 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
|
3634 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
|
3635 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3636 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3637 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3638 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
|
3639 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
|
3640 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3641 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3642 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3643 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3644 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3645 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3646 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3647 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3648 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3649 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3650 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3651 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3652 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
|
3653 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3654 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3655 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
|
3656 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3657 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
|
3658 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
|
3659 /* 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
|
3660 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3661 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3662 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3663 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3664 } |
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 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3667 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3668 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3669 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3670 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3671 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3672 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3673 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3674 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3675 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
|
3676 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
|
3677 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
|
3678 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3679 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3680 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
|
3681 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
|
3682 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
|
3683 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3684 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3685 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3686 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3687 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3688 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3689 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3690 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
|
3691 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3692 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3693 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3694 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3695 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3696 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
|
3697 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3698 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3699 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
3700 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
|
3701 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3702 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
|
3703 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
|
3704 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
|
3705 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
|
3706 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
|
3707 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3708 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
|
3709 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3710 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3711 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
|
3712 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
|
3713 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
|
3714 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3715 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3716 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
|
3717 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
|
3718 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3719 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3720 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3721 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3722 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
|
3723 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3724 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3725 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
|
3726 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3727 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3728 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3729 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3730 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
|
3731 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
|
3732 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3733 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3734 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
3735 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
|
3736 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3737 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
|
3738 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
|
3739 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
|
3740 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
|
3741 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
|
3742 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3743 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
|
3744 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3745 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3746 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3747 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3748 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3749 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3750 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
|
3751 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
|
3752 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3753 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3754 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3755 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
|
3756 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
|
3757 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3758 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3759 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3760 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3761 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3762 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3763 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3764 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3765 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3766 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3767 posx -= 0x10000L; |
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 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
|
3770 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3771 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3772 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
|
3773 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
|
3774 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3775 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3776 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3777 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3778 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
|
3779 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3780 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3781 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
|
3782 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3783 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3784 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3785 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3786 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3787 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
|
3788 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3789 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3790 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
3791 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
|
3792 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3793 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
|
3794 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
|
3795 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
|
3796 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
|
3797 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
|
3798 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3799 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
|
3800 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3801 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
|
3802 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3803 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3804 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
|
3805 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
|
3806 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
|
3807 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3808 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3809 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
|
3810 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3811 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
|
3812 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
|
3813 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3814 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3815 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3816 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3817 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
|
3818 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3819 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3820 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
|
3821 /* 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
|
3822 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3823 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3824 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3825 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3826 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3827 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3828 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3829 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3830 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3831 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3832 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3833 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3834 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3835 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3836 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3837 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
|
3838 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
|
3839 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
|
3840 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3841 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3842 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
|
3843 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
|
3844 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
|
3845 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3846 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3847 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3848 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3849 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3850 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3851 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3852 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
|
3853 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3854 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3855 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3856 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3857 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
|
3858 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
|
3859 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3860 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3861 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
3862 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
|
3863 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3864 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
|
3865 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
|
3866 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
|
3867 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
|
3868 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
|
3869 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3870 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
|
3871 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3872 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
|
3873 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3874 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3875 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3876 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3877 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3878 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3879 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
|
3880 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
|
3881 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3882 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3883 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3884 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
|
3885 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
|
3886 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3887 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3888 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3889 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3890 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3891 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3892 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3893 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3894 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3895 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3896 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3897 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3898 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
|
3899 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3900 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3901 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
|
3902 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3903 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
|
3904 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
|
3905 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3906 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3907 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3908 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3909 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
|
3910 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3911 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3912 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
|
3913 /* 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
|
3914 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3915 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3916 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3917 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3918 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3919 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3920 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3921 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3922 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3923 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3924 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3925 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3926 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3927 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3928 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3929 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
|
3930 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
|
3931 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
|
3932 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3933 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3934 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
|
3935 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
|
3936 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
|
3937 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3938 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3939 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3940 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3941 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3942 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3943 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3944 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
|
3945 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3946 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3947 ++dst; |
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 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3950 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
|
3951 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3952 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3953 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
3954 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
|
3955 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3956 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
|
3957 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3958 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
|
3959 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3960 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3961 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3962 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3963 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3964 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3965 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
|
3966 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
|
3967 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3968 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3969 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3970 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
|
3971 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
|
3972 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3973 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3974 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3975 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3976 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3977 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3978 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3979 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3980 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3981 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3982 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3983 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3984 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
|
3985 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3986 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3987 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
|
3988 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
|
3989 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3990 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3991 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3992 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3993 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3994 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
|
3995 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3996 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3997 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
3998 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
|
3999 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4000 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
|
4001 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4002 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
|
4003 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4004 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
|
4005 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4006 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4007 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
|
4008 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
|
4009 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
|
4010 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4011 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4012 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
|
4013 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4014 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
|
4015 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
|
4016 /* 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
|
4017 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4018 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4019 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4020 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4021 } |
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 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4024 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4025 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4026 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4027 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4028 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4029 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4030 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4031 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4032 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
|
4033 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
|
4034 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
|
4035 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4036 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4037 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
|
4038 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
|
4039 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
|
4040 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4041 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4042 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4043 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4044 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4045 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4046 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4047 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
|
4048 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4049 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4050 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4051 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4052 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
|
4053 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
|
4054 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4055 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4056 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
4057 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
|
4058 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4059 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
|
4060 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4061 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
|
4062 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4063 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
|
4064 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4065 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4066 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4067 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4068 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4069 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4070 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
|
4071 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
|
4072 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4073 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4074 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4075 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
|
4076 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
|
4077 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4078 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4079 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4080 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4081 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4082 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4083 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4084 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4085 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4086 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4087 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4088 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4089 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
|
4090 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4091 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4092 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
|
4093 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4094 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
|
4095 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
|
4096 /* 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
|
4097 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4098 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4099 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4100 srcB = (srcB * srcA) / 255; |
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 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4103 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4104 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4105 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4106 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4107 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4108 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4109 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4110 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4111 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4112 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
|
4113 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
|
4114 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
|
4115 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4116 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4117 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
|
4118 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
|
4119 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
|
4120 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4121 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4122 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4123 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4124 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4125 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4126 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4127 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
|
4128 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4129 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4130 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4131 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4132 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4133 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
|
4134 } |
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 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
4137 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
|
4138 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4139 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
|
4140 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
|
4141 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
|
4142 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
|
4143 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
|
4144 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4145 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
|
4146 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4147 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4148 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
|
4149 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
|
4150 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
|
4151 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4152 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4153 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
|
4154 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
|
4155 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4156 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4157 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4158 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4159 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
|
4160 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4161 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4162 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
|
4163 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4164 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4165 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4166 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4167 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
|
4168 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
|
4169 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4170 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4171 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
4172 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
|
4173 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4174 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
|
4175 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
|
4176 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
|
4177 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
|
4178 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
|
4179 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4180 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
|
4181 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4182 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4183 int incy, incx; |
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 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4186 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4187 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
|
4188 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
|
4189 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4190 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4191 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4192 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
|
4193 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
|
4194 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4195 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4196 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4197 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4198 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4199 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4200 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4201 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4202 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4203 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4204 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4205 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4206 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
|
4207 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4208 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4209 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
|
4210 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
|
4211 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4212 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4213 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4214 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4215 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
|
4216 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4217 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4218 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
|
4219 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4220 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4221 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4222 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4223 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4224 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
|
4225 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4226 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4227 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
4228 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
|
4229 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4230 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
|
4231 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
|
4232 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
|
4233 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
|
4234 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
|
4235 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4236 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
|
4237 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4238 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
|
4239 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4240 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4241 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
|
4242 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
|
4243 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
|
4244 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4245 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4246 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
|
4247 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4248 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
|
4249 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
|
4250 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4251 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4252 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4253 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4254 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
|
4255 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4256 } |
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_BLEND|SDL_COPY_ADD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4258 /* 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
|
4259 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4260 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4261 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4262 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4263 } |
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 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4266 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4267 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4268 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4269 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4270 dstB = srcB; |
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 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4273 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4274 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
|
4275 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
|
4276 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
|
4277 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4278 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4279 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
|
4280 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
|
4281 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
|
4282 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4283 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4284 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4285 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4286 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4287 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4288 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4289 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
|
4290 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4291 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4292 ++dst; |
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 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
|
4295 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
|
4296 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4297 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4298 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
4299 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
|
4300 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4301 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
|
4302 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
|
4303 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
|
4304 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
|
4305 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
|
4306 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4307 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
|
4308 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4309 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
|
4310 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4311 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4312 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4313 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4314 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4315 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4316 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
|
4317 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
|
4318 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4319 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4320 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4321 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
|
4322 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
|
4323 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4324 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4325 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4326 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4327 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4328 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4329 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4330 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4331 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4332 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4333 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4334 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4335 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
|
4336 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4337 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4338 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
|
4339 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4340 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
|
4341 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
|
4342 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4343 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4344 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4345 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4346 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
|
4347 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4348 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4349 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
|
4350 /* 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
|
4351 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4352 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4353 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4354 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4355 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4356 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4357 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4358 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4359 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4360 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4361 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4362 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4363 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4364 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4365 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4366 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
|
4367 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
|
4368 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
|
4369 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4370 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4371 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
|
4372 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
|
4373 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
|
4374 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4375 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4376 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4377 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4378 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4379 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4380 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4381 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
|
4382 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4383 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4384 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4385 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4386 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4387 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
|
4388 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4389 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4390 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
4391 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
|
4392 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4393 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
|
4394 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4395 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
|
4396 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4397 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4398 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4399 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4400 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4401 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4402 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
|
4403 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
|
4404 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4405 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4406 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4407 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
|
4408 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
|
4409 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4410 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4411 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4412 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4413 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4414 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4415 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4416 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4417 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4418 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4419 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4420 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4421 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
|
4422 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4423 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4424 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
|
4425 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
|
4426 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4427 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4428 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4429 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4430 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4431 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
|
4432 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4433 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4434 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
4435 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
|
4436 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4437 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
|
4438 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4439 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
|
4440 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4441 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
|
4442 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4443 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4444 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
|
4445 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
|
4446 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
|
4447 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4448 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4449 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
|
4450 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4451 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
|
4452 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
|
4453 /* 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
|
4454 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4455 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4456 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4457 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4458 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4459 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4460 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4461 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4462 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4463 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4464 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4465 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4466 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4467 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4468 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4469 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
|
4470 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
|
4471 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
|
4472 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4473 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4474 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
|
4475 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
|
4476 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
|
4477 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4478 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4479 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4480 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4481 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4482 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4483 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4484 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
|
4485 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4486 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4487 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4488 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4489 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
|
4490 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
|
4491 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4492 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4493 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
4494 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
|
4495 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4496 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
|
4497 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4498 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
|
4499 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4500 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
|
4501 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4502 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4503 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4504 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4505 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4506 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4507 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
|
4508 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
|
4509 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4510 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4511 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4512 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
|
4513 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
|
4514 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4515 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4516 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4517 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4518 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4519 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4520 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4521 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4522 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4523 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4524 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4525 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4526 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
|
4527 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4528 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4529 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
|
4530 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4531 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
|
4532 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
|
4533 /* 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
|
4534 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4535 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4536 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4537 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4538 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4539 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4540 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4541 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4542 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4543 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4544 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4545 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4546 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4547 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4548 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4549 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
|
4550 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
|
4551 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
|
4552 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4553 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4554 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
|
4555 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
|
4556 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
|
4557 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4558 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4559 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4560 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4561 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4562 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4563 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4564 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
|
4565 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4566 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4567 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4568 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4569 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4570 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
|
4571 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4572 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4573 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
4574 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
|
4575 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4576 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
|
4577 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
|
4578 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
|
4579 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
|
4580 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
|
4581 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4582 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
|
4583 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4584 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4585 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
|
4586 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
|
4587 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
|
4588 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4589 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4590 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
|
4591 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
|
4592 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4593 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4594 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4595 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4596 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
|
4597 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4598 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4599 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
|
4600 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4601 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4602 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4603 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4604 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
|
4605 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
|
4606 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4607 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4608 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
4609 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
|
4610 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4611 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
|
4612 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
|
4613 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
|
4614 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
|
4615 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
|
4616 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4617 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
|
4618 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4619 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4620 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4621 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4622 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4623 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4624 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
|
4625 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
|
4626 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4627 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4628 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4629 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
|
4630 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
|
4631 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4632 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4633 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4634 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4635 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4636 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4637 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4638 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4639 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4640 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4641 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4642 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4643 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
|
4644 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4645 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4646 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
|
4647 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
|
4648 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4649 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4650 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4651 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4652 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
|
4653 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4654 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4655 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
|
4656 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4657 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4658 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4659 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4660 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4661 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
|
4662 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4663 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4664 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
4665 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
|
4666 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4667 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
|
4668 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
|
4669 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
|
4670 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
|
4671 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
|
4672 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4673 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
|
4674 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4675 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
|
4676 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4677 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4678 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
|
4679 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
|
4680 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
|
4681 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4682 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4683 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
|
4684 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4685 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
|
4686 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
|
4687 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4688 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4689 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4690 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4691 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
|
4692 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4693 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4694 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
|
4695 /* 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
|
4696 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4697 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4698 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4699 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4700 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4701 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4702 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4703 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4704 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4705 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4706 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4707 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4708 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4709 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4710 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4711 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
|
4712 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
|
4713 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
|
4714 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4715 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4716 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
|
4717 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
|
4718 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
|
4719 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4720 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4721 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4722 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4723 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4724 break; |
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 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
|
4727 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4728 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4729 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4730 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4731 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
|
4732 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
|
4733 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4734 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4735 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
4736 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
|
4737 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4738 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
|
4739 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
|
4740 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
|
4741 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
|
4742 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
|
4743 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4744 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
|
4745 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4746 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
|
4747 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4748 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4749 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4750 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4751 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4752 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4753 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
|
4754 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
|
4755 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4756 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4757 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4758 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
|
4759 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
|
4760 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4761 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4762 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4763 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4764 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4765 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4766 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4767 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4768 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4769 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4770 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4771 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4772 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
|
4773 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4774 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4775 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
|
4776 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4777 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
|
4778 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
|
4779 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4780 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4781 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4782 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4783 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
|
4784 srcA = (srcA * modulateA) / 255; |
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 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
|
4787 /* 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
|
4788 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4789 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4790 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4791 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4792 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4793 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4794 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4795 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4796 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4797 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4798 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4799 dstB = srcB; |
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 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4802 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4803 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
|
4804 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
|
4805 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
|
4806 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4807 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4808 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
|
4809 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
|
4810 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
|
4811 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4812 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4813 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4814 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4815 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4816 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4817 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4818 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
|
4819 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4820 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4821 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4822 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4823 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4824 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
|
4825 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4826 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4827 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
4828 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
|
4829 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4830 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
|
4831 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4832 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
|
4833 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4834 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4835 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4836 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4837 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4838 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4839 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
|
4840 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
|
4841 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4842 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4843 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4844 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
|
4845 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
|
4846 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4847 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4848 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4849 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4850 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4851 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4852 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4853 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4854 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4855 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4856 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4857 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4858 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
|
4859 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4860 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4861 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
|
4862 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
|
4863 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4864 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4865 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4866 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4867 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4868 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
|
4869 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4870 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4871 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
4872 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
|
4873 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4874 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
|
4875 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4876 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
|
4877 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4878 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
|
4879 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4880 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4881 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
|
4882 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
|
4883 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
|
4884 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4885 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4886 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
|
4887 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4888 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
|
4889 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
|
4890 /* 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
|
4891 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4892 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4893 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4894 srcB = (srcB * srcA) / 255; |
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 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4897 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4898 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4899 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4900 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4901 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4902 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4903 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4904 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4905 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4906 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
|
4907 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
|
4908 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
|
4909 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4910 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4911 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
|
4912 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
|
4913 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
|
4914 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4915 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4916 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4917 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4918 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4919 break; |
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 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
|
4922 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4923 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4924 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4925 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4926 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
|
4927 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
|
4928 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4929 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4930 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
4931 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
|
4932 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4933 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
|
4934 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4935 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
|
4936 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4937 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
|
4938 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4939 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4940 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4941 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4942 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4943 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4944 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
|
4945 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
|
4946 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4947 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4948 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4949 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
|
4950 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
|
4951 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4952 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4953 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4954 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4955 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4956 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4957 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4958 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4959 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4960 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4961 posx -= 0x10000L; |
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 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
|
4964 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4965 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4966 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
|
4967 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4968 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
|
4969 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
|
4970 /* 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
|
4971 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4972 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4973 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4974 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4975 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4976 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4977 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4978 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4979 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4980 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4981 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4982 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4983 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4984 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4985 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4986 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
|
4987 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
|
4988 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
|
4989 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4990 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4991 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
|
4992 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
|
4993 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
|
4994 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4995 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4996 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4997 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4998 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4999 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5000 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5001 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
|
5002 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5003 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5004 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5005 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5006 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5007 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
|
5008 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5009 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5010 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5011 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
|
5012 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5013 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
|
5014 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
|
5015 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
|
5016 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
|
5017 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
|
5018 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5019 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
|
5020 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5021 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5022 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
|
5023 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
|
5024 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
|
5025 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5026 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5027 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
|
5028 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
|
5029 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5030 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5031 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5032 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5033 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
|
5034 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5035 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5036 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
|
5037 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5038 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5039 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5040 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5041 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
|
5042 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
|
5043 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5044 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5045 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5046 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
|
5047 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5048 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
|
5049 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
|
5050 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
|
5051 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
|
5052 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
|
5053 Uint32 pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5054 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
|
5055 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5056 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5057 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5058 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5059 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5060 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5061 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
|
5062 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
|
5063 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5064 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5065 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5066 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
|
5067 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
|
5068 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5069 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5070 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5071 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5072 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5073 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5074 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5075 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5076 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5077 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5078 posx -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5079 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5080 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
|
5081 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5082 pixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5083 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
|
5084 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
|
5085 R = (R * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5086 G = (G * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5087 B = (B * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5088 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5089 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
|
5090 A = (A * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5091 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5092 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
|
5093 *dst = pixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5094 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5095 ++dst; |
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 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5098 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
|
5099 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5100 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5101 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5102 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
|
5103 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5104 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
|
5105 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
|
5106 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
|
5107 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
|
5108 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
|
5109 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5110 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
|
5111 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5112 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
|
5113 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5114 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5115 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
|
5116 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
|
5117 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
|
5118 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5119 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5120 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
|
5121 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5122 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
|
5123 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
|
5124 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5125 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5126 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5127 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5128 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
|
5129 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5130 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5131 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
|
5132 /* 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
|
5133 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5134 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5135 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5136 srcB = (srcB * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5137 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5138 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5139 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5140 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5141 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5142 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5143 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5144 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5145 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5146 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5147 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5148 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
|
5149 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
|
5150 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
|
5151 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5152 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5153 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
|
5154 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
|
5155 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
|
5156 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5157 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5158 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5159 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5160 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5161 break; |
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 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
|
5164 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5165 ++src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5166 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5167 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5168 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
|
5169 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
|
5170 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5171 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5172 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5173 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
|
5174 { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5175 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
|
5176 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
|
5177 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
|
5178 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
|
5179 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
|
5180 Uint32 srcpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5181 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
|
5182 Uint32 dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5183 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
|
5184 int srcy, srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5185 int posy, posx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5186 int incy, incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5187 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5188 srcy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5189 posy = 0; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5190 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
|
5191 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
|
5192 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5193 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5194 Uint32 *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5195 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
|
5196 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
|
5197 srcx = -1; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5198 posx = 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5199 while (posy >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5200 ++srcy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5201 posy -= 0x10000L; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5202 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5203 while (n--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5204 if (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5205 while (posx >= 0x10000L) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5206 ++srcx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5207 posx -= 0x10000L; |
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 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
|
5210 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5211 srcpixel = *src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5212 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
|
5213 dstpixel = *dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5214 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
|
5215 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
|
5216 srcR = (srcR * modulateR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5217 srcG = (srcG * modulateG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5218 srcB = (srcB * modulateB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5219 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5220 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
|
5221 srcA = (srcA * modulateA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5222 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5223 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
|
5224 /* 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
|
5225 if (srcA < 255) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5226 srcR = (srcR * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5227 srcG = (srcG * srcA) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5228 srcB = (srcB * srcA) / 255; |
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 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5232 case SDL_COPY_MASK: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5233 if (srcA) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5234 dstR = srcR; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5235 dstG = srcG; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5236 dstB = srcB; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5237 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5238 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5239 case SDL_COPY_BLEND: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5240 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
|
5241 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
|
5242 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
|
5243 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5244 case SDL_COPY_ADD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5245 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
|
5246 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
|
5247 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
|
5248 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5249 case SDL_COPY_MOD: |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5250 dstR = (srcR * dstR) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5251 dstG = (srcG * dstG) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5252 dstB = (srcB * dstB) / 255; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5253 break; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5254 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5255 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
|
5256 *dst = dstpixel; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5257 posx += incx; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5258 ++dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5259 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5260 posy += incy; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5261 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
|
5262 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5263 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5264 |
2267
c785543d1843
Okay, still some bugs, but everything builds again...
Sam Lantinga <slouken@libsdl.org>
parents:
2263
diff
changeset
|
5265 SDL_BlitFuncEntry SDL_GeneratedBlitFuncTable[] = { |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5266 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_RGB888_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5267 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGB888_RGB888_Blend }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5268 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_RGB888_Blend_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5269 { 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
|
5270 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_RGB888_Modulate_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5271 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGB888_RGB888_Modulate_Blend }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5272 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_RGB888_Modulate_Blend_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5273 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_BGR888_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5274 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGB888_BGR888_Blend }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5275 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_BGR888_Blend_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5276 { 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
|
5277 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_BGR888_Modulate_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5278 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGB888_BGR888_Modulate_Blend }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5279 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_BGR888_Modulate_Blend_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5280 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5281 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Blend }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5282 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Blend_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5283 { 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
|
5284 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Modulate_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5285 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Modulate_Blend }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5286 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Modulate_Blend_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5287 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_BGR888_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5288 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGR888_BGR888_Blend }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5289 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_BGR888_Blend_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5290 { 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
|
5291 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_BGR888_Modulate_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5292 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGR888_BGR888_Modulate_Blend }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5293 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_BGR888_Modulate_Blend_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5294 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5295 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Blend }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5296 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Blend_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5297 { 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
|
5298 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Modulate_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5299 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Modulate_Blend }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5300 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Modulate_Blend_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5301 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_BGR888_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5302 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ARGB8888_BGR888_Blend }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5303 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_BGR888_Blend_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5304 { 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
|
5305 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_BGR888_Modulate_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5306 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ARGB8888_BGR888_Modulate_Blend }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5307 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_BGR888_Modulate_Blend_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5308 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5309 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Blend }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5310 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Blend_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5311 { 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
|
5312 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Modulate_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5313 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Modulate_Blend }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5314 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Modulate_Blend_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5315 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_BGR888_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5316 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGBA8888_BGR888_Blend }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5317 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_BGR888_Blend_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5318 { 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
|
5319 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_BGR888_Modulate_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5320 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGBA8888_BGR888_Modulate_Blend }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5321 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_BGR888_Modulate_Blend_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5322 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5323 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Blend }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5324 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Blend_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5325 { 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
|
5326 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Modulate_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5327 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Modulate_Blend }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5328 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Modulate_Blend_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5329 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_BGR888_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5330 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ABGR8888_BGR888_Blend }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5331 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_BGR888_Blend_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5332 { 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
|
5333 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_BGR888_Modulate_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5334 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ABGR8888_BGR888_Modulate_Blend }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5335 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_BGR888_Modulate_Blend_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5336 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5337 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Blend }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5338 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Blend_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5339 { 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
|
5340 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Modulate_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5341 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Modulate_Blend }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5342 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Modulate_Blend_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5343 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_BGR888_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5344 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGRA8888_BGR888_Blend }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5345 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_BGR888_Blend_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5346 { 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
|
5347 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_BGR888_Modulate_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5348 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGRA8888_BGR888_Modulate_Blend }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5349 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_BGR888_Modulate_Blend_Scale }, |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5350 { 0, 0, 0, 0, NULL } |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5351 }; |
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
5352 |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5353 /* *INDENT-ON* */ |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5354 |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5355 /* vi: set ts=4 sw=4 expandtab: */ |