1 | /* DO NOT EDIT! This file is generated by sdlgenblit.pl */ |
2 | /* |
3 | Simple DirectMedia Layer |
4 | Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org> |
5 | |
6 | This software is provided 'as-is', without any express or implied |
7 | warranty. In no event will the authors be held liable for any damages |
8 | arising from the use of this software. |
9 | |
10 | Permission is granted to anyone to use this software for any purpose, |
11 | including commercial applications, and to alter it and redistribute it |
12 | freely, subject to the following restrictions: |
13 | |
14 | 1. The origin of this software must not be misrepresented; you must not |
15 | claim that you wrote the original software. If you use this software |
16 | in a product, an acknowledgment in the product documentation would be |
17 | appreciated but is not required. |
18 | 2. Altered source versions must be plainly marked as such, and must not be |
19 | misrepresented as being the original software. |
20 | 3. This notice may not be removed or altered from any source distribution. |
21 | */ |
22 | #include "../SDL_internal.h" |
23 | |
24 | #if SDL_HAVE_BLIT_AUTO |
25 | |
26 | /* *INDENT-OFF* */ |
27 | |
28 | #include "SDL_video.h" |
29 | #include "SDL_blit.h" |
30 | #include "SDL_blit_auto.h" |
31 | |
32 | static void SDL_Blit_RGB888_RGB888_Scale(SDL_BlitInfo *info) |
33 | { |
34 | int srcy, srcx; |
35 | Uint32 posy, posx; |
36 | int incy, incx; |
37 | |
38 | incy = (info->src_h << 16) / info->dst_h; |
39 | incx = (info->src_w << 16) / info->dst_w; |
40 | posy = incy / 2; |
41 | |
42 | while (info->dst_h--) { |
43 | Uint32 *src = 0; |
44 | Uint32 *dst = (Uint32 *)info->dst; |
45 | int n = info->dst_w; |
46 | posx = incx / 2; |
47 | |
48 | srcy = posy >> 16; |
49 | while (n--) { |
50 | srcx = posx >> 16; |
51 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
52 | *dst = *src; |
53 | posx += incx; |
54 | ++dst; |
55 | } |
56 | posy += incy; |
57 | info->dst += info->dst_pitch; |
58 | } |
59 | } |
60 | |
61 | static void SDL_Blit_RGB888_RGB888_Blend(SDL_BlitInfo *info) |
62 | { |
63 | const int flags = info->flags; |
64 | Uint32 srcpixel; |
65 | Uint32 srcR, srcG, srcB; |
66 | Uint32 dstpixel; |
67 | Uint32 dstR, dstG, dstB; |
68 | |
69 | while (info->dst_h--) { |
70 | Uint32 *src = (Uint32 *)info->src; |
71 | Uint32 *dst = (Uint32 *)info->dst; |
72 | int n = info->dst_w; |
73 | while (n--) { |
74 | srcpixel = *src; |
75 | srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; |
76 | dstpixel = *dst; |
77 | dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; |
78 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
79 | case SDL_COPY_BLEND: |
80 | dstR = srcR; |
81 | dstG = srcG; |
82 | dstB = srcB; |
83 | break; |
84 | case SDL_COPY_ADD: |
85 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
86 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
87 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
88 | break; |
89 | case SDL_COPY_MOD: |
90 | dstR = (srcR * dstR) / 255; |
91 | dstG = (srcG * dstG) / 255; |
92 | dstB = (srcB * dstB) / 255; |
93 | break; |
94 | case SDL_COPY_MUL: |
95 | dstR = (srcR * dstR) / 255; |
96 | dstG = (srcG * dstG) / 255; |
97 | dstB = (srcB * dstB) / 255; |
98 | break; |
99 | } |
100 | dstpixel = (dstR << 16) | (dstG << 8) | dstB; |
101 | *dst = dstpixel; |
102 | ++src; |
103 | ++dst; |
104 | } |
105 | info->src += info->src_pitch; |
106 | info->dst += info->dst_pitch; |
107 | } |
108 | } |
109 | |
110 | static void SDL_Blit_RGB888_RGB888_Blend_Scale(SDL_BlitInfo *info) |
111 | { |
112 | const int flags = info->flags; |
113 | Uint32 srcpixel; |
114 | Uint32 srcR, srcG, srcB; |
115 | Uint32 dstpixel; |
116 | Uint32 dstR, dstG, dstB; |
117 | int srcy, srcx; |
118 | Uint32 posy, posx; |
119 | int incy, incx; |
120 | |
121 | incy = (info->src_h << 16) / info->dst_h; |
122 | incx = (info->src_w << 16) / info->dst_w; |
123 | posy = incy / 2; |
124 | |
125 | while (info->dst_h--) { |
126 | Uint32 *src = 0; |
127 | Uint32 *dst = (Uint32 *)info->dst; |
128 | int n = info->dst_w; |
129 | posx = incx / 2; |
130 | |
131 | srcy = posy >> 16; |
132 | while (n--) { |
133 | srcx = posx >> 16; |
134 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
135 | srcpixel = *src; |
136 | srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; |
137 | dstpixel = *dst; |
138 | dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; |
139 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
140 | case SDL_COPY_BLEND: |
141 | dstR = srcR; |
142 | dstG = srcG; |
143 | dstB = srcB; |
144 | break; |
145 | case SDL_COPY_ADD: |
146 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
147 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
148 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
149 | break; |
150 | case SDL_COPY_MOD: |
151 | dstR = (srcR * dstR) / 255; |
152 | dstG = (srcG * dstG) / 255; |
153 | dstB = (srcB * dstB) / 255; |
154 | break; |
155 | case SDL_COPY_MUL: |
156 | dstR = (srcR * dstR) / 255; |
157 | dstG = (srcG * dstG) / 255; |
158 | dstB = (srcB * dstB) / 255; |
159 | break; |
160 | } |
161 | dstpixel = (dstR << 16) | (dstG << 8) | dstB; |
162 | *dst = dstpixel; |
163 | posx += incx; |
164 | ++dst; |
165 | } |
166 | posy += incy; |
167 | info->dst += info->dst_pitch; |
168 | } |
169 | } |
170 | |
171 | static void SDL_Blit_RGB888_RGB888_Modulate(SDL_BlitInfo *info) |
172 | { |
173 | const int flags = info->flags; |
174 | const Uint32 modulateR = info->r; |
175 | const Uint32 modulateG = info->g; |
176 | const Uint32 modulateB = info->b; |
177 | Uint32 pixel; |
178 | Uint32 R, G, B; |
179 | |
180 | while (info->dst_h--) { |
181 | Uint32 *src = (Uint32 *)info->src; |
182 | Uint32 *dst = (Uint32 *)info->dst; |
183 | int n = info->dst_w; |
184 | while (n--) { |
185 | pixel = *src; |
186 | R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; |
187 | if (flags & SDL_COPY_MODULATE_COLOR) { |
188 | R = (R * modulateR) / 255; |
189 | G = (G * modulateG) / 255; |
190 | B = (B * modulateB) / 255; |
191 | } |
192 | pixel = (R << 16) | (G << 8) | B; |
193 | *dst = pixel; |
194 | ++src; |
195 | ++dst; |
196 | } |
197 | info->src += info->src_pitch; |
198 | info->dst += info->dst_pitch; |
199 | } |
200 | } |
201 | |
202 | static void SDL_Blit_RGB888_RGB888_Modulate_Scale(SDL_BlitInfo *info) |
203 | { |
204 | const int flags = info->flags; |
205 | const Uint32 modulateR = info->r; |
206 | const Uint32 modulateG = info->g; |
207 | const Uint32 modulateB = info->b; |
208 | Uint32 pixel; |
209 | Uint32 R, G, B; |
210 | int srcy, srcx; |
211 | Uint32 posy, posx; |
212 | int incy, incx; |
213 | |
214 | incy = (info->src_h << 16) / info->dst_h; |
215 | incx = (info->src_w << 16) / info->dst_w; |
216 | posy = incy / 2; |
217 | |
218 | while (info->dst_h--) { |
219 | Uint32 *src = 0; |
220 | Uint32 *dst = (Uint32 *)info->dst; |
221 | int n = info->dst_w; |
222 | posx = incx / 2; |
223 | |
224 | srcy = posy >> 16; |
225 | while (n--) { |
226 | srcx = posx >> 16; |
227 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
228 | pixel = *src; |
229 | R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; |
230 | if (flags & SDL_COPY_MODULATE_COLOR) { |
231 | R = (R * modulateR) / 255; |
232 | G = (G * modulateG) / 255; |
233 | B = (B * modulateB) / 255; |
234 | } |
235 | pixel = (R << 16) | (G << 8) | B; |
236 | *dst = pixel; |
237 | posx += incx; |
238 | ++dst; |
239 | } |
240 | posy += incy; |
241 | info->dst += info->dst_pitch; |
242 | } |
243 | } |
244 | |
245 | static void SDL_Blit_RGB888_RGB888_Modulate_Blend(SDL_BlitInfo *info) |
246 | { |
247 | const int flags = info->flags; |
248 | const Uint32 modulateR = info->r; |
249 | const Uint32 modulateG = info->g; |
250 | const Uint32 modulateB = info->b; |
251 | const Uint32 modulateA = info->a; |
252 | Uint32 srcpixel; |
253 | const Uint32 srcA = (flags & SDL_COPY_MODULATE_ALPHA) ? modulateA : 0xFF; |
254 | Uint32 srcR, srcG, srcB; |
255 | Uint32 dstpixel; |
256 | Uint32 dstR, dstG, dstB; |
257 | |
258 | while (info->dst_h--) { |
259 | Uint32 *src = (Uint32 *)info->src; |
260 | Uint32 *dst = (Uint32 *)info->dst; |
261 | int n = info->dst_w; |
262 | while (n--) { |
263 | srcpixel = *src; |
264 | srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; |
265 | dstpixel = *dst; |
266 | dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; |
267 | if (flags & SDL_COPY_MODULATE_COLOR) { |
268 | srcR = (srcR * modulateR) / 255; |
269 | srcG = (srcG * modulateG) / 255; |
270 | srcB = (srcB * modulateB) / 255; |
271 | } |
272 | if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
273 | /* This goes away if we ever use premultiplied alpha */ |
274 | if (srcA < 255) { |
275 | srcR = (srcR * srcA) / 255; |
276 | srcG = (srcG * srcA) / 255; |
277 | srcB = (srcB * srcA) / 255; |
278 | } |
279 | } |
280 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
281 | case SDL_COPY_BLEND: |
282 | dstR = srcR + ((255 - srcA) * dstR) / 255; |
283 | dstG = srcG + ((255 - srcA) * dstG) / 255; |
284 | dstB = srcB + ((255 - srcA) * dstB) / 255; |
285 | break; |
286 | case SDL_COPY_ADD: |
287 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
288 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
289 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
290 | break; |
291 | case SDL_COPY_MOD: |
292 | dstR = (srcR * dstR) / 255; |
293 | dstG = (srcG * dstG) / 255; |
294 | dstB = (srcB * dstB) / 255; |
295 | break; |
296 | case SDL_COPY_MUL: |
297 | dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255; |
298 | dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255; |
299 | dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255; |
300 | break; |
301 | } |
302 | dstpixel = (dstR << 16) | (dstG << 8) | dstB; |
303 | *dst = dstpixel; |
304 | ++src; |
305 | ++dst; |
306 | } |
307 | info->src += info->src_pitch; |
308 | info->dst += info->dst_pitch; |
309 | } |
310 | } |
311 | |
312 | static void SDL_Blit_RGB888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info) |
313 | { |
314 | const int flags = info->flags; |
315 | const Uint32 modulateR = info->r; |
316 | const Uint32 modulateG = info->g; |
317 | const Uint32 modulateB = info->b; |
318 | const Uint32 modulateA = info->a; |
319 | Uint32 srcpixel; |
320 | const Uint32 srcA = (flags & SDL_COPY_MODULATE_ALPHA) ? modulateA : 0xFF; |
321 | Uint32 srcR, srcG, srcB; |
322 | Uint32 dstpixel; |
323 | Uint32 dstR, dstG, dstB; |
324 | int srcy, srcx; |
325 | Uint32 posy, posx; |
326 | int incy, incx; |
327 | |
328 | incy = (info->src_h << 16) / info->dst_h; |
329 | incx = (info->src_w << 16) / info->dst_w; |
330 | posy = incy / 2; |
331 | |
332 | while (info->dst_h--) { |
333 | Uint32 *src = 0; |
334 | Uint32 *dst = (Uint32 *)info->dst; |
335 | int n = info->dst_w; |
336 | posx = incx / 2; |
337 | |
338 | srcy = posy >> 16; |
339 | while (n--) { |
340 | srcx = posx >> 16; |
341 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
342 | srcpixel = *src; |
343 | srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; |
344 | dstpixel = *dst; |
345 | dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; |
346 | if (flags & SDL_COPY_MODULATE_COLOR) { |
347 | srcR = (srcR * modulateR) / 255; |
348 | srcG = (srcG * modulateG) / 255; |
349 | srcB = (srcB * modulateB) / 255; |
350 | } |
351 | if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
352 | /* This goes away if we ever use premultiplied alpha */ |
353 | if (srcA < 255) { |
354 | srcR = (srcR * srcA) / 255; |
355 | srcG = (srcG * srcA) / 255; |
356 | srcB = (srcB * srcA) / 255; |
357 | } |
358 | } |
359 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
360 | case SDL_COPY_BLEND: |
361 | dstR = srcR + ((255 - srcA) * dstR) / 255; |
362 | dstG = srcG + ((255 - srcA) * dstG) / 255; |
363 | dstB = srcB + ((255 - srcA) * dstB) / 255; |
364 | break; |
365 | case SDL_COPY_ADD: |
366 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
367 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
368 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
369 | break; |
370 | case SDL_COPY_MOD: |
371 | dstR = (srcR * dstR) / 255; |
372 | dstG = (srcG * dstG) / 255; |
373 | dstB = (srcB * dstB) / 255; |
374 | break; |
375 | case SDL_COPY_MUL: |
376 | dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255; |
377 | dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255; |
378 | dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255; |
379 | break; |
380 | } |
381 | dstpixel = (dstR << 16) | (dstG << 8) | dstB; |
382 | *dst = dstpixel; |
383 | posx += incx; |
384 | ++dst; |
385 | } |
386 | posy += incy; |
387 | info->dst += info->dst_pitch; |
388 | } |
389 | } |
390 | |
391 | static void SDL_Blit_RGB888_BGR888_Scale(SDL_BlitInfo *info) |
392 | { |
393 | Uint32 pixel; |
394 | Uint32 R, G, B; |
395 | int srcy, srcx; |
396 | Uint32 posy, posx; |
397 | int incy, incx; |
398 | |
399 | incy = (info->src_h << 16) / info->dst_h; |
400 | incx = (info->src_w << 16) / info->dst_w; |
401 | posy = incy / 2; |
402 | |
403 | while (info->dst_h--) { |
404 | Uint32 *src = 0; |
405 | Uint32 *dst = (Uint32 *)info->dst; |
406 | int n = info->dst_w; |
407 | posx = incx / 2; |
408 | |
409 | srcy = posy >> 16; |
410 | while (n--) { |
411 | srcx = posx >> 16; |
412 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
413 | pixel = *src; |
414 | R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; |
415 | pixel = (B << 16) | (G << 8) | R; |
416 | *dst = pixel; |
417 | posx += incx; |
418 | ++dst; |
419 | } |
420 | posy += incy; |
421 | info->dst += info->dst_pitch; |
422 | } |
423 | } |
424 | |
425 | static void SDL_Blit_RGB888_BGR888_Blend(SDL_BlitInfo *info) |
426 | { |
427 | const int flags = info->flags; |
428 | Uint32 srcpixel; |
429 | Uint32 srcR, srcG, srcB; |
430 | Uint32 dstpixel; |
431 | Uint32 dstR, dstG, dstB; |
432 | |
433 | while (info->dst_h--) { |
434 | Uint32 *src = (Uint32 *)info->src; |
435 | Uint32 *dst = (Uint32 *)info->dst; |
436 | int n = info->dst_w; |
437 | while (n--) { |
438 | srcpixel = *src; |
439 | srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; |
440 | dstpixel = *dst; |
441 | dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; |
442 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
443 | case SDL_COPY_BLEND: |
444 | dstR = srcR; |
445 | dstG = srcG; |
446 | dstB = srcB; |
447 | break; |
448 | case SDL_COPY_ADD: |
449 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
450 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
451 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
452 | break; |
453 | case SDL_COPY_MOD: |
454 | dstR = (srcR * dstR) / 255; |
455 | dstG = (srcG * dstG) / 255; |
456 | dstB = (srcB * dstB) / 255; |
457 | break; |
458 | case SDL_COPY_MUL: |
459 | dstR = (srcR * dstR) / 255; |
460 | dstG = (srcG * dstG) / 255; |
461 | dstB = (srcB * dstB) / 255; |
462 | break; |
463 | } |
464 | dstpixel = (dstB << 16) | (dstG << 8) | dstR; |
465 | *dst = dstpixel; |
466 | ++src; |
467 | ++dst; |
468 | } |
469 | info->src += info->src_pitch; |
470 | info->dst += info->dst_pitch; |
471 | } |
472 | } |
473 | |
474 | static void SDL_Blit_RGB888_BGR888_Blend_Scale(SDL_BlitInfo *info) |
475 | { |
476 | const int flags = info->flags; |
477 | Uint32 srcpixel; |
478 | Uint32 srcR, srcG, srcB; |
479 | Uint32 dstpixel; |
480 | Uint32 dstR, dstG, dstB; |
481 | int srcy, srcx; |
482 | Uint32 posy, posx; |
483 | int incy, incx; |
484 | |
485 | incy = (info->src_h << 16) / info->dst_h; |
486 | incx = (info->src_w << 16) / info->dst_w; |
487 | posy = incy / 2; |
488 | |
489 | while (info->dst_h--) { |
490 | Uint32 *src = 0; |
491 | Uint32 *dst = (Uint32 *)info->dst; |
492 | int n = info->dst_w; |
493 | posx = incx / 2; |
494 | |
495 | srcy = posy >> 16; |
496 | while (n--) { |
497 | srcx = posx >> 16; |
498 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
499 | srcpixel = *src; |
500 | srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; |
501 | dstpixel = *dst; |
502 | dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; |
503 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
504 | case SDL_COPY_BLEND: |
505 | dstR = srcR; |
506 | dstG = srcG; |
507 | dstB = srcB; |
508 | break; |
509 | case SDL_COPY_ADD: |
510 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
511 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
512 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
513 | break; |
514 | case SDL_COPY_MOD: |
515 | dstR = (srcR * dstR) / 255; |
516 | dstG = (srcG * dstG) / 255; |
517 | dstB = (srcB * dstB) / 255; |
518 | break; |
519 | case SDL_COPY_MUL: |
520 | dstR = (srcR * dstR) / 255; |
521 | dstG = (srcG * dstG) / 255; |
522 | dstB = (srcB * dstB) / 255; |
523 | break; |
524 | } |
525 | dstpixel = (dstB << 16) | (dstG << 8) | dstR; |
526 | *dst = dstpixel; |
527 | posx += incx; |
528 | ++dst; |
529 | } |
530 | posy += incy; |
531 | info->dst += info->dst_pitch; |
532 | } |
533 | } |
534 | |
535 | static void SDL_Blit_RGB888_BGR888_Modulate(SDL_BlitInfo *info) |
536 | { |
537 | const int flags = info->flags; |
538 | const Uint32 modulateR = info->r; |
539 | const Uint32 modulateG = info->g; |
540 | const Uint32 modulateB = info->b; |
541 | Uint32 pixel; |
542 | Uint32 R, G, B; |
543 | |
544 | while (info->dst_h--) { |
545 | Uint32 *src = (Uint32 *)info->src; |
546 | Uint32 *dst = (Uint32 *)info->dst; |
547 | int n = info->dst_w; |
548 | while (n--) { |
549 | pixel = *src; |
550 | R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; |
551 | if (flags & SDL_COPY_MODULATE_COLOR) { |
552 | R = (R * modulateR) / 255; |
553 | G = (G * modulateG) / 255; |
554 | B = (B * modulateB) / 255; |
555 | } |
556 | pixel = (B << 16) | (G << 8) | R; |
557 | *dst = pixel; |
558 | ++src; |
559 | ++dst; |
560 | } |
561 | info->src += info->src_pitch; |
562 | info->dst += info->dst_pitch; |
563 | } |
564 | } |
565 | |
566 | static void SDL_Blit_RGB888_BGR888_Modulate_Scale(SDL_BlitInfo *info) |
567 | { |
568 | const int flags = info->flags; |
569 | const Uint32 modulateR = info->r; |
570 | const Uint32 modulateG = info->g; |
571 | const Uint32 modulateB = info->b; |
572 | Uint32 pixel; |
573 | Uint32 R, G, B; |
574 | int srcy, srcx; |
575 | Uint32 posy, posx; |
576 | int incy, incx; |
577 | |
578 | incy = (info->src_h << 16) / info->dst_h; |
579 | incx = (info->src_w << 16) / info->dst_w; |
580 | posy = incy / 2; |
581 | |
582 | while (info->dst_h--) { |
583 | Uint32 *src = 0; |
584 | Uint32 *dst = (Uint32 *)info->dst; |
585 | int n = info->dst_w; |
586 | posx = incx / 2; |
587 | |
588 | srcy = posy >> 16; |
589 | while (n--) { |
590 | srcx = posx >> 16; |
591 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
592 | pixel = *src; |
593 | R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; |
594 | if (flags & SDL_COPY_MODULATE_COLOR) { |
595 | R = (R * modulateR) / 255; |
596 | G = (G * modulateG) / 255; |
597 | B = (B * modulateB) / 255; |
598 | } |
599 | pixel = (B << 16) | (G << 8) | R; |
600 | *dst = pixel; |
601 | posx += incx; |
602 | ++dst; |
603 | } |
604 | posy += incy; |
605 | info->dst += info->dst_pitch; |
606 | } |
607 | } |
608 | |
609 | static void SDL_Blit_RGB888_BGR888_Modulate_Blend(SDL_BlitInfo *info) |
610 | { |
611 | const int flags = info->flags; |
612 | const Uint32 modulateR = info->r; |
613 | const Uint32 modulateG = info->g; |
614 | const Uint32 modulateB = info->b; |
615 | const Uint32 modulateA = info->a; |
616 | Uint32 srcpixel; |
617 | const Uint32 srcA = (flags & SDL_COPY_MODULATE_ALPHA) ? modulateA : 0xFF; |
618 | Uint32 srcR, srcG, srcB; |
619 | Uint32 dstpixel; |
620 | Uint32 dstR, dstG, dstB; |
621 | |
622 | while (info->dst_h--) { |
623 | Uint32 *src = (Uint32 *)info->src; |
624 | Uint32 *dst = (Uint32 *)info->dst; |
625 | int n = info->dst_w; |
626 | while (n--) { |
627 | srcpixel = *src; |
628 | srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; |
629 | dstpixel = *dst; |
630 | dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; |
631 | if (flags & SDL_COPY_MODULATE_COLOR) { |
632 | srcR = (srcR * modulateR) / 255; |
633 | srcG = (srcG * modulateG) / 255; |
634 | srcB = (srcB * modulateB) / 255; |
635 | } |
636 | if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
637 | /* This goes away if we ever use premultiplied alpha */ |
638 | if (srcA < 255) { |
639 | srcR = (srcR * srcA) / 255; |
640 | srcG = (srcG * srcA) / 255; |
641 | srcB = (srcB * srcA) / 255; |
642 | } |
643 | } |
644 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
645 | case SDL_COPY_BLEND: |
646 | dstR = srcR + ((255 - srcA) * dstR) / 255; |
647 | dstG = srcG + ((255 - srcA) * dstG) / 255; |
648 | dstB = srcB + ((255 - srcA) * dstB) / 255; |
649 | break; |
650 | case SDL_COPY_ADD: |
651 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
652 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
653 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
654 | break; |
655 | case SDL_COPY_MOD: |
656 | dstR = (srcR * dstR) / 255; |
657 | dstG = (srcG * dstG) / 255; |
658 | dstB = (srcB * dstB) / 255; |
659 | break; |
660 | case SDL_COPY_MUL: |
661 | dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255; |
662 | dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255; |
663 | dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255; |
664 | break; |
665 | } |
666 | dstpixel = (dstB << 16) | (dstG << 8) | dstR; |
667 | *dst = dstpixel; |
668 | ++src; |
669 | ++dst; |
670 | } |
671 | info->src += info->src_pitch; |
672 | info->dst += info->dst_pitch; |
673 | } |
674 | } |
675 | |
676 | static void SDL_Blit_RGB888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info) |
677 | { |
678 | const int flags = info->flags; |
679 | const Uint32 modulateR = info->r; |
680 | const Uint32 modulateG = info->g; |
681 | const Uint32 modulateB = info->b; |
682 | const Uint32 modulateA = info->a; |
683 | Uint32 srcpixel; |
684 | const Uint32 srcA = (flags & SDL_COPY_MODULATE_ALPHA) ? modulateA : 0xFF; |
685 | Uint32 srcR, srcG, srcB; |
686 | Uint32 dstpixel; |
687 | Uint32 dstR, dstG, dstB; |
688 | int srcy, srcx; |
689 | Uint32 posy, posx; |
690 | int incy, incx; |
691 | |
692 | incy = (info->src_h << 16) / info->dst_h; |
693 | incx = (info->src_w << 16) / info->dst_w; |
694 | posy = incy / 2; |
695 | |
696 | while (info->dst_h--) { |
697 | Uint32 *src = 0; |
698 | Uint32 *dst = (Uint32 *)info->dst; |
699 | int n = info->dst_w; |
700 | posx = incx / 2; |
701 | |
702 | srcy = posy >> 16; |
703 | while (n--) { |
704 | srcx = posx >> 16; |
705 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
706 | srcpixel = *src; |
707 | srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; |
708 | dstpixel = *dst; |
709 | dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; |
710 | if (flags & SDL_COPY_MODULATE_COLOR) { |
711 | srcR = (srcR * modulateR) / 255; |
712 | srcG = (srcG * modulateG) / 255; |
713 | srcB = (srcB * modulateB) / 255; |
714 | } |
715 | if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
716 | /* This goes away if we ever use premultiplied alpha */ |
717 | if (srcA < 255) { |
718 | srcR = (srcR * srcA) / 255; |
719 | srcG = (srcG * srcA) / 255; |
720 | srcB = (srcB * srcA) / 255; |
721 | } |
722 | } |
723 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
724 | case SDL_COPY_BLEND: |
725 | dstR = srcR + ((255 - srcA) * dstR) / 255; |
726 | dstG = srcG + ((255 - srcA) * dstG) / 255; |
727 | dstB = srcB + ((255 - srcA) * dstB) / 255; |
728 | break; |
729 | case SDL_COPY_ADD: |
730 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
731 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
732 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
733 | break; |
734 | case SDL_COPY_MOD: |
735 | dstR = (srcR * dstR) / 255; |
736 | dstG = (srcG * dstG) / 255; |
737 | dstB = (srcB * dstB) / 255; |
738 | break; |
739 | case SDL_COPY_MUL: |
740 | dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255; |
741 | dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255; |
742 | dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255; |
743 | break; |
744 | } |
745 | dstpixel = (dstB << 16) | (dstG << 8) | dstR; |
746 | *dst = dstpixel; |
747 | posx += incx; |
748 | ++dst; |
749 | } |
750 | posy += incy; |
751 | info->dst += info->dst_pitch; |
752 | } |
753 | } |
754 | |
755 | static void SDL_Blit_RGB888_ARGB8888_Scale(SDL_BlitInfo *info) |
756 | { |
757 | Uint32 pixel; |
758 | const Uint32 A = 0xFF; |
759 | Uint32 R, G, B; |
760 | int srcy, srcx; |
761 | Uint32 posy, posx; |
762 | int incy, incx; |
763 | |
764 | incy = (info->src_h << 16) / info->dst_h; |
765 | incx = (info->src_w << 16) / info->dst_w; |
766 | posy = incy / 2; |
767 | |
768 | while (info->dst_h--) { |
769 | Uint32 *src = 0; |
770 | Uint32 *dst = (Uint32 *)info->dst; |
771 | int n = info->dst_w; |
772 | posx = incx / 2; |
773 | |
774 | srcy = posy >> 16; |
775 | while (n--) { |
776 | srcx = posx >> 16; |
777 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
778 | pixel = *src; |
779 | R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; |
780 | pixel = (A << 24) | (R << 16) | (G << 8) | B; |
781 | *dst = pixel; |
782 | posx += incx; |
783 | ++dst; |
784 | } |
785 | posy += incy; |
786 | info->dst += info->dst_pitch; |
787 | } |
788 | } |
789 | |
790 | static void SDL_Blit_RGB888_ARGB8888_Blend(SDL_BlitInfo *info) |
791 | { |
792 | const int flags = info->flags; |
793 | Uint32 srcpixel; |
794 | Uint32 srcR, srcG, srcB; |
795 | Uint32 dstpixel; |
796 | Uint32 dstR, dstG, dstB, dstA; |
797 | |
798 | while (info->dst_h--) { |
799 | Uint32 *src = (Uint32 *)info->src; |
800 | Uint32 *dst = (Uint32 *)info->dst; |
801 | int n = info->dst_w; |
802 | while (n--) { |
803 | srcpixel = *src; |
804 | srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; |
805 | dstpixel = *dst; |
806 | dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24); |
807 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
808 | case SDL_COPY_BLEND: |
809 | dstR = srcR; |
810 | dstG = srcG; |
811 | dstB = srcB; |
812 | dstA = 0xFF; |
813 | break; |
814 | case SDL_COPY_ADD: |
815 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
816 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
817 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
818 | break; |
819 | case SDL_COPY_MOD: |
820 | dstR = (srcR * dstR) / 255; |
821 | dstG = (srcG * dstG) / 255; |
822 | dstB = (srcB * dstB) / 255; |
823 | break; |
824 | case SDL_COPY_MUL: |
825 | dstR = (srcR * dstR) / 255; |
826 | dstG = (srcG * dstG) / 255; |
827 | dstB = (srcB * dstB) / 255; |
828 | dstA = 0xFF; |
829 | break; |
830 | } |
831 | dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB; |
832 | *dst = dstpixel; |
833 | ++src; |
834 | ++dst; |
835 | } |
836 | info->src += info->src_pitch; |
837 | info->dst += info->dst_pitch; |
838 | } |
839 | } |
840 | |
841 | static void SDL_Blit_RGB888_ARGB8888_Blend_Scale(SDL_BlitInfo *info) |
842 | { |
843 | const int flags = info->flags; |
844 | Uint32 srcpixel; |
845 | Uint32 srcR, srcG, srcB; |
846 | Uint32 dstpixel; |
847 | Uint32 dstR, dstG, dstB, dstA; |
848 | int srcy, srcx; |
849 | Uint32 posy, posx; |
850 | int incy, incx; |
851 | |
852 | incy = (info->src_h << 16) / info->dst_h; |
853 | incx = (info->src_w << 16) / info->dst_w; |
854 | posy = incy / 2; |
855 | |
856 | while (info->dst_h--) { |
857 | Uint32 *src = 0; |
858 | Uint32 *dst = (Uint32 *)info->dst; |
859 | int n = info->dst_w; |
860 | posx = incx / 2; |
861 | |
862 | srcy = posy >> 16; |
863 | while (n--) { |
864 | srcx = posx >> 16; |
865 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
866 | srcpixel = *src; |
867 | srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; |
868 | dstpixel = *dst; |
869 | dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24); |
870 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
871 | case SDL_COPY_BLEND: |
872 | dstR = srcR; |
873 | dstG = srcG; |
874 | dstB = srcB; |
875 | dstA = 0xFF; |
876 | break; |
877 | case SDL_COPY_ADD: |
878 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
879 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
880 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
881 | break; |
882 | case SDL_COPY_MOD: |
883 | dstR = (srcR * dstR) / 255; |
884 | dstG = (srcG * dstG) / 255; |
885 | dstB = (srcB * dstB) / 255; |
886 | break; |
887 | case SDL_COPY_MUL: |
888 | dstR = (srcR * dstR) / 255; |
889 | dstG = (srcG * dstG) / 255; |
890 | dstB = (srcB * dstB) / 255; |
891 | dstA = 0xFF; |
892 | break; |
893 | } |
894 | dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB; |
895 | *dst = dstpixel; |
896 | posx += incx; |
897 | ++dst; |
898 | } |
899 | posy += incy; |
900 | info->dst += info->dst_pitch; |
901 | } |
902 | } |
903 | |
904 | static void SDL_Blit_RGB888_ARGB8888_Modulate(SDL_BlitInfo *info) |
905 | { |
906 | const int flags = info->flags; |
907 | const Uint32 modulateR = info->r; |
908 | const Uint32 modulateG = info->g; |
909 | const Uint32 modulateB = info->b; |
910 | const Uint32 modulateA = info->a; |
911 | Uint32 pixel; |
912 | const Uint32 A = (flags & SDL_COPY_MODULATE_ALPHA) ? modulateA : 0xFF; |
913 | Uint32 R, G, B; |
914 | |
915 | while (info->dst_h--) { |
916 | Uint32 *src = (Uint32 *)info->src; |
917 | Uint32 *dst = (Uint32 *)info->dst; |
918 | int n = info->dst_w; |
919 | while (n--) { |
920 | pixel = *src; |
921 | R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; |
922 | if (flags & SDL_COPY_MODULATE_COLOR) { |
923 | R = (R * modulateR) / 255; |
924 | G = (G * modulateG) / 255; |
925 | B = (B * modulateB) / 255; |
926 | } |
927 | pixel = (A << 24) | (R << 16) | (G << 8) | B; |
928 | *dst = pixel; |
929 | ++src; |
930 | ++dst; |
931 | } |
932 | info->src += info->src_pitch; |
933 | info->dst += info->dst_pitch; |
934 | } |
935 | } |
936 | |
937 | static void SDL_Blit_RGB888_ARGB8888_Modulate_Scale(SDL_BlitInfo *info) |
938 | { |
939 | const int flags = info->flags; |
940 | const Uint32 modulateR = info->r; |
941 | const Uint32 modulateG = info->g; |
942 | const Uint32 modulateB = info->b; |
943 | const Uint32 modulateA = info->a; |
944 | Uint32 pixel; |
945 | const Uint32 A = (flags & SDL_COPY_MODULATE_ALPHA) ? modulateA : 0xFF; |
946 | Uint32 R, G, B; |
947 | int srcy, srcx; |
948 | Uint32 posy, posx; |
949 | int incy, incx; |
950 | |
951 | incy = (info->src_h << 16) / info->dst_h; |
952 | incx = (info->src_w << 16) / info->dst_w; |
953 | posy = incy / 2; |
954 | |
955 | while (info->dst_h--) { |
956 | Uint32 *src = 0; |
957 | Uint32 *dst = (Uint32 *)info->dst; |
958 | int n = info->dst_w; |
959 | posx = incx / 2; |
960 | |
961 | srcy = posy >> 16; |
962 | while (n--) { |
963 | srcx = posx >> 16; |
964 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
965 | pixel = *src; |
966 | R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; |
967 | if (flags & SDL_COPY_MODULATE_COLOR) { |
968 | R = (R * modulateR) / 255; |
969 | G = (G * modulateG) / 255; |
970 | B = (B * modulateB) / 255; |
971 | } |
972 | pixel = (A << 24) | (R << 16) | (G << 8) | B; |
973 | *dst = pixel; |
974 | posx += incx; |
975 | ++dst; |
976 | } |
977 | posy += incy; |
978 | info->dst += info->dst_pitch; |
979 | } |
980 | } |
981 | |
982 | static void SDL_Blit_RGB888_ARGB8888_Modulate_Blend(SDL_BlitInfo *info) |
983 | { |
984 | const int flags = info->flags; |
985 | const Uint32 modulateR = info->r; |
986 | const Uint32 modulateG = info->g; |
987 | const Uint32 modulateB = info->b; |
988 | const Uint32 modulateA = info->a; |
989 | Uint32 srcpixel; |
990 | const Uint32 srcA = (flags & SDL_COPY_MODULATE_ALPHA) ? modulateA : 0xFF; |
991 | Uint32 srcR, srcG, srcB; |
992 | Uint32 dstpixel; |
993 | Uint32 dstR, dstG, dstB, dstA; |
994 | |
995 | while (info->dst_h--) { |
996 | Uint32 *src = (Uint32 *)info->src; |
997 | Uint32 *dst = (Uint32 *)info->dst; |
998 | int n = info->dst_w; |
999 | while (n--) { |
1000 | srcpixel = *src; |
1001 | srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; |
1002 | dstpixel = *dst; |
1003 | dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24); |
1004 | if (flags & SDL_COPY_MODULATE_COLOR) { |
1005 | srcR = (srcR * modulateR) / 255; |
1006 | srcG = (srcG * modulateG) / 255; |
1007 | srcB = (srcB * modulateB) / 255; |
1008 | } |
1009 | if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
1010 | /* This goes away if we ever use premultiplied alpha */ |
1011 | if (srcA < 255) { |
1012 | srcR = (srcR * srcA) / 255; |
1013 | srcG = (srcG * srcA) / 255; |
1014 | srcB = (srcB * srcA) / 255; |
1015 | } |
1016 | } |
1017 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
1018 | case SDL_COPY_BLEND: |
1019 | dstR = srcR + ((255 - srcA) * dstR) / 255; |
1020 | dstG = srcG + ((255 - srcA) * dstG) / 255; |
1021 | dstB = srcB + ((255 - srcA) * dstB) / 255; |
1022 | dstA = srcA + ((255 - srcA) * dstA) / 255; |
1023 | break; |
1024 | case SDL_COPY_ADD: |
1025 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
1026 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
1027 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
1028 | break; |
1029 | case SDL_COPY_MOD: |
1030 | dstR = (srcR * dstR) / 255; |
1031 | dstG = (srcG * dstG) / 255; |
1032 | dstB = (srcB * dstB) / 255; |
1033 | break; |
1034 | case SDL_COPY_MUL: |
1035 | dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255; |
1036 | dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255; |
1037 | dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255; |
1038 | dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) dstA = 255; |
1039 | break; |
1040 | } |
1041 | dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB; |
1042 | *dst = dstpixel; |
1043 | ++src; |
1044 | ++dst; |
1045 | } |
1046 | info->src += info->src_pitch; |
1047 | info->dst += info->dst_pitch; |
1048 | } |
1049 | } |
1050 | |
1051 | static void SDL_Blit_RGB888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info) |
1052 | { |
1053 | const int flags = info->flags; |
1054 | const Uint32 modulateR = info->r; |
1055 | const Uint32 modulateG = info->g; |
1056 | const Uint32 modulateB = info->b; |
1057 | const Uint32 modulateA = info->a; |
1058 | Uint32 srcpixel; |
1059 | const Uint32 srcA = (flags & SDL_COPY_MODULATE_ALPHA) ? modulateA : 0xFF; |
1060 | Uint32 srcR, srcG, srcB; |
1061 | Uint32 dstpixel; |
1062 | Uint32 dstR, dstG, dstB, dstA; |
1063 | int srcy, srcx; |
1064 | Uint32 posy, posx; |
1065 | int incy, incx; |
1066 | |
1067 | incy = (info->src_h << 16) / info->dst_h; |
1068 | incx = (info->src_w << 16) / info->dst_w; |
1069 | posy = incy / 2; |
1070 | |
1071 | while (info->dst_h--) { |
1072 | Uint32 *src = 0; |
1073 | Uint32 *dst = (Uint32 *)info->dst; |
1074 | int n = info->dst_w; |
1075 | posx = incx / 2; |
1076 | |
1077 | srcy = posy >> 16; |
1078 | while (n--) { |
1079 | srcx = posx >> 16; |
1080 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
1081 | srcpixel = *src; |
1082 | srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; |
1083 | dstpixel = *dst; |
1084 | dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24); |
1085 | if (flags & SDL_COPY_MODULATE_COLOR) { |
1086 | srcR = (srcR * modulateR) / 255; |
1087 | srcG = (srcG * modulateG) / 255; |
1088 | srcB = (srcB * modulateB) / 255; |
1089 | } |
1090 | if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
1091 | /* This goes away if we ever use premultiplied alpha */ |
1092 | if (srcA < 255) { |
1093 | srcR = (srcR * srcA) / 255; |
1094 | srcG = (srcG * srcA) / 255; |
1095 | srcB = (srcB * srcA) / 255; |
1096 | } |
1097 | } |
1098 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
1099 | case SDL_COPY_BLEND: |
1100 | dstR = srcR + ((255 - srcA) * dstR) / 255; |
1101 | dstG = srcG + ((255 - srcA) * dstG) / 255; |
1102 | dstB = srcB + ((255 - srcA) * dstB) / 255; |
1103 | dstA = srcA + ((255 - srcA) * dstA) / 255; |
1104 | break; |
1105 | case SDL_COPY_ADD: |
1106 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
1107 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
1108 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
1109 | break; |
1110 | case SDL_COPY_MOD: |
1111 | dstR = (srcR * dstR) / 255; |
1112 | dstG = (srcG * dstG) / 255; |
1113 | dstB = (srcB * dstB) / 255; |
1114 | break; |
1115 | case SDL_COPY_MUL: |
1116 | dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255; |
1117 | dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255; |
1118 | dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255; |
1119 | dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) dstA = 255; |
1120 | break; |
1121 | } |
1122 | dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB; |
1123 | *dst = dstpixel; |
1124 | posx += incx; |
1125 | ++dst; |
1126 | } |
1127 | posy += incy; |
1128 | info->dst += info->dst_pitch; |
1129 | } |
1130 | } |
1131 | |
1132 | static void SDL_Blit_BGR888_RGB888_Scale(SDL_BlitInfo *info) |
1133 | { |
1134 | Uint32 pixel; |
1135 | Uint32 R, G, B; |
1136 | int srcy, srcx; |
1137 | Uint32 posy, posx; |
1138 | int incy, incx; |
1139 | |
1140 | incy = (info->src_h << 16) / info->dst_h; |
1141 | incx = (info->src_w << 16) / info->dst_w; |
1142 | posy = incy / 2; |
1143 | |
1144 | while (info->dst_h--) { |
1145 | Uint32 *src = 0; |
1146 | Uint32 *dst = (Uint32 *)info->dst; |
1147 | int n = info->dst_w; |
1148 | posx = incx / 2; |
1149 | |
1150 | srcy = posy >> 16; |
1151 | while (n--) { |
1152 | srcx = posx >> 16; |
1153 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
1154 | pixel = *src; |
1155 | B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; |
1156 | pixel = (R << 16) | (G << 8) | B; |
1157 | *dst = pixel; |
1158 | posx += incx; |
1159 | ++dst; |
1160 | } |
1161 | posy += incy; |
1162 | info->dst += info->dst_pitch; |
1163 | } |
1164 | } |
1165 | |
1166 | static void SDL_Blit_BGR888_RGB888_Blend(SDL_BlitInfo *info) |
1167 | { |
1168 | const int flags = info->flags; |
1169 | Uint32 srcpixel; |
1170 | Uint32 srcR, srcG, srcB; |
1171 | Uint32 dstpixel; |
1172 | Uint32 dstR, dstG, dstB; |
1173 | |
1174 | while (info->dst_h--) { |
1175 | Uint32 *src = (Uint32 *)info->src; |
1176 | Uint32 *dst = (Uint32 *)info->dst; |
1177 | int n = info->dst_w; |
1178 | while (n--) { |
1179 | srcpixel = *src; |
1180 | srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; |
1181 | dstpixel = *dst; |
1182 | dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; |
1183 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
1184 | case SDL_COPY_BLEND: |
1185 | dstR = srcR; |
1186 | dstG = srcG; |
1187 | dstB = srcB; |
1188 | break; |
1189 | case SDL_COPY_ADD: |
1190 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
1191 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
1192 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
1193 | break; |
1194 | case SDL_COPY_MOD: |
1195 | dstR = (srcR * dstR) / 255; |
1196 | dstG = (srcG * dstG) / 255; |
1197 | dstB = (srcB * dstB) / 255; |
1198 | break; |
1199 | case SDL_COPY_MUL: |
1200 | dstR = (srcR * dstR) / 255; |
1201 | dstG = (srcG * dstG) / 255; |
1202 | dstB = (srcB * dstB) / 255; |
1203 | break; |
1204 | } |
1205 | dstpixel = (dstR << 16) | (dstG << 8) | dstB; |
1206 | *dst = dstpixel; |
1207 | ++src; |
1208 | ++dst; |
1209 | } |
1210 | info->src += info->src_pitch; |
1211 | info->dst += info->dst_pitch; |
1212 | } |
1213 | } |
1214 | |
1215 | static void SDL_Blit_BGR888_RGB888_Blend_Scale(SDL_BlitInfo *info) |
1216 | { |
1217 | const int flags = info->flags; |
1218 | Uint32 srcpixel; |
1219 | Uint32 srcR, srcG, srcB; |
1220 | Uint32 dstpixel; |
1221 | Uint32 dstR, dstG, dstB; |
1222 | int srcy, srcx; |
1223 | Uint32 posy, posx; |
1224 | int incy, incx; |
1225 | |
1226 | incy = (info->src_h << 16) / info->dst_h; |
1227 | incx = (info->src_w << 16) / info->dst_w; |
1228 | posy = incy / 2; |
1229 | |
1230 | while (info->dst_h--) { |
1231 | Uint32 *src = 0; |
1232 | Uint32 *dst = (Uint32 *)info->dst; |
1233 | int n = info->dst_w; |
1234 | posx = incx / 2; |
1235 | |
1236 | srcy = posy >> 16; |
1237 | while (n--) { |
1238 | srcx = posx >> 16; |
1239 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
1240 | srcpixel = *src; |
1241 | srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; |
1242 | dstpixel = *dst; |
1243 | dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; |
1244 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
1245 | case SDL_COPY_BLEND: |
1246 | dstR = srcR; |
1247 | dstG = srcG; |
1248 | dstB = srcB; |
1249 | break; |
1250 | case SDL_COPY_ADD: |
1251 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
1252 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
1253 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
1254 | break; |
1255 | case SDL_COPY_MOD: |
1256 | dstR = (srcR * dstR) / 255; |
1257 | dstG = (srcG * dstG) / 255; |
1258 | dstB = (srcB * dstB) / 255; |
1259 | break; |
1260 | case SDL_COPY_MUL: |
1261 | dstR = (srcR * dstR) / 255; |
1262 | dstG = (srcG * dstG) / 255; |
1263 | dstB = (srcB * dstB) / 255; |
1264 | break; |
1265 | } |
1266 | dstpixel = (dstR << 16) | (dstG << 8) | dstB; |
1267 | *dst = dstpixel; |
1268 | posx += incx; |
1269 | ++dst; |
1270 | } |
1271 | posy += incy; |
1272 | info->dst += info->dst_pitch; |
1273 | } |
1274 | } |
1275 | |
1276 | static void SDL_Blit_BGR888_RGB888_Modulate(SDL_BlitInfo *info) |
1277 | { |
1278 | const int flags = info->flags; |
1279 | const Uint32 modulateR = info->r; |
1280 | const Uint32 modulateG = info->g; |
1281 | const Uint32 modulateB = info->b; |
1282 | Uint32 pixel; |
1283 | Uint32 R, G, B; |
1284 | |
1285 | while (info->dst_h--) { |
1286 | Uint32 *src = (Uint32 *)info->src; |
1287 | Uint32 *dst = (Uint32 *)info->dst; |
1288 | int n = info->dst_w; |
1289 | while (n--) { |
1290 | pixel = *src; |
1291 | B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; |
1292 | if (flags & SDL_COPY_MODULATE_COLOR) { |
1293 | R = (R * modulateR) / 255; |
1294 | G = (G * modulateG) / 255; |
1295 | B = (B * modulateB) / 255; |
1296 | } |
1297 | pixel = (R << 16) | (G << 8) | B; |
1298 | *dst = pixel; |
1299 | ++src; |
1300 | ++dst; |
1301 | } |
1302 | info->src += info->src_pitch; |
1303 | info->dst += info->dst_pitch; |
1304 | } |
1305 | } |
1306 | |
1307 | static void SDL_Blit_BGR888_RGB888_Modulate_Scale(SDL_BlitInfo *info) |
1308 | { |
1309 | const int flags = info->flags; |
1310 | const Uint32 modulateR = info->r; |
1311 | const Uint32 modulateG = info->g; |
1312 | const Uint32 modulateB = info->b; |
1313 | Uint32 pixel; |
1314 | Uint32 R, G, B; |
1315 | int srcy, srcx; |
1316 | Uint32 posy, posx; |
1317 | int incy, incx; |
1318 | |
1319 | incy = (info->src_h << 16) / info->dst_h; |
1320 | incx = (info->src_w << 16) / info->dst_w; |
1321 | posy = incy / 2; |
1322 | |
1323 | while (info->dst_h--) { |
1324 | Uint32 *src = 0; |
1325 | Uint32 *dst = (Uint32 *)info->dst; |
1326 | int n = info->dst_w; |
1327 | posx = incx / 2; |
1328 | |
1329 | srcy = posy >> 16; |
1330 | while (n--) { |
1331 | srcx = posx >> 16; |
1332 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
1333 | pixel = *src; |
1334 | B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; |
1335 | if (flags & SDL_COPY_MODULATE_COLOR) { |
1336 | R = (R * modulateR) / 255; |
1337 | G = (G * modulateG) / 255; |
1338 | B = (B * modulateB) / 255; |
1339 | } |
1340 | pixel = (R << 16) | (G << 8) | B; |
1341 | *dst = pixel; |
1342 | posx += incx; |
1343 | ++dst; |
1344 | } |
1345 | posy += incy; |
1346 | info->dst += info->dst_pitch; |
1347 | } |
1348 | } |
1349 | |
1350 | static void SDL_Blit_BGR888_RGB888_Modulate_Blend(SDL_BlitInfo *info) |
1351 | { |
1352 | const int flags = info->flags; |
1353 | const Uint32 modulateR = info->r; |
1354 | const Uint32 modulateG = info->g; |
1355 | const Uint32 modulateB = info->b; |
1356 | const Uint32 modulateA = info->a; |
1357 | Uint32 srcpixel; |
1358 | const Uint32 srcA = (flags & SDL_COPY_MODULATE_ALPHA) ? modulateA : 0xFF; |
1359 | Uint32 srcR, srcG, srcB; |
1360 | Uint32 dstpixel; |
1361 | Uint32 dstR, dstG, dstB; |
1362 | |
1363 | while (info->dst_h--) { |
1364 | Uint32 *src = (Uint32 *)info->src; |
1365 | Uint32 *dst = (Uint32 *)info->dst; |
1366 | int n = info->dst_w; |
1367 | while (n--) { |
1368 | srcpixel = *src; |
1369 | srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; |
1370 | dstpixel = *dst; |
1371 | dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; |
1372 | if (flags & SDL_COPY_MODULATE_COLOR) { |
1373 | srcR = (srcR * modulateR) / 255; |
1374 | srcG = (srcG * modulateG) / 255; |
1375 | srcB = (srcB * modulateB) / 255; |
1376 | } |
1377 | if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
1378 | /* This goes away if we ever use premultiplied alpha */ |
1379 | if (srcA < 255) { |
1380 | srcR = (srcR * srcA) / 255; |
1381 | srcG = (srcG * srcA) / 255; |
1382 | srcB = (srcB * srcA) / 255; |
1383 | } |
1384 | } |
1385 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
1386 | case SDL_COPY_BLEND: |
1387 | dstR = srcR + ((255 - srcA) * dstR) / 255; |
1388 | dstG = srcG + ((255 - srcA) * dstG) / 255; |
1389 | dstB = srcB + ((255 - srcA) * dstB) / 255; |
1390 | break; |
1391 | case SDL_COPY_ADD: |
1392 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
1393 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
1394 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
1395 | break; |
1396 | case SDL_COPY_MOD: |
1397 | dstR = (srcR * dstR) / 255; |
1398 | dstG = (srcG * dstG) / 255; |
1399 | dstB = (srcB * dstB) / 255; |
1400 | break; |
1401 | case SDL_COPY_MUL: |
1402 | dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255; |
1403 | dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255; |
1404 | dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255; |
1405 | break; |
1406 | } |
1407 | dstpixel = (dstR << 16) | (dstG << 8) | dstB; |
1408 | *dst = dstpixel; |
1409 | ++src; |
1410 | ++dst; |
1411 | } |
1412 | info->src += info->src_pitch; |
1413 | info->dst += info->dst_pitch; |
1414 | } |
1415 | } |
1416 | |
1417 | static void SDL_Blit_BGR888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info) |
1418 | { |
1419 | const int flags = info->flags; |
1420 | const Uint32 modulateR = info->r; |
1421 | const Uint32 modulateG = info->g; |
1422 | const Uint32 modulateB = info->b; |
1423 | const Uint32 modulateA = info->a; |
1424 | Uint32 srcpixel; |
1425 | const Uint32 srcA = (flags & SDL_COPY_MODULATE_ALPHA) ? modulateA : 0xFF; |
1426 | Uint32 srcR, srcG, srcB; |
1427 | Uint32 dstpixel; |
1428 | Uint32 dstR, dstG, dstB; |
1429 | int srcy, srcx; |
1430 | Uint32 posy, posx; |
1431 | int incy, incx; |
1432 | |
1433 | incy = (info->src_h << 16) / info->dst_h; |
1434 | incx = (info->src_w << 16) / info->dst_w; |
1435 | posy = incy / 2; |
1436 | |
1437 | while (info->dst_h--) { |
1438 | Uint32 *src = 0; |
1439 | Uint32 *dst = (Uint32 *)info->dst; |
1440 | int n = info->dst_w; |
1441 | posx = incx / 2; |
1442 | |
1443 | srcy = posy >> 16; |
1444 | while (n--) { |
1445 | srcx = posx >> 16; |
1446 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
1447 | srcpixel = *src; |
1448 | srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; |
1449 | dstpixel = *dst; |
1450 | dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; |
1451 | if (flags & SDL_COPY_MODULATE_COLOR) { |
1452 | srcR = (srcR * modulateR) / 255; |
1453 | srcG = (srcG * modulateG) / 255; |
1454 | srcB = (srcB * modulateB) / 255; |
1455 | } |
1456 | if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
1457 | /* This goes away if we ever use premultiplied alpha */ |
1458 | if (srcA < 255) { |
1459 | srcR = (srcR * srcA) / 255; |
1460 | srcG = (srcG * srcA) / 255; |
1461 | srcB = (srcB * srcA) / 255; |
1462 | } |
1463 | } |
1464 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
1465 | case SDL_COPY_BLEND: |
1466 | dstR = srcR + ((255 - srcA) * dstR) / 255; |
1467 | dstG = srcG + ((255 - srcA) * dstG) / 255; |
1468 | dstB = srcB + ((255 - srcA) * dstB) / 255; |
1469 | break; |
1470 | case SDL_COPY_ADD: |
1471 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
1472 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
1473 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
1474 | break; |
1475 | case SDL_COPY_MOD: |
1476 | dstR = (srcR * dstR) / 255; |
1477 | dstG = (srcG * dstG) / 255; |
1478 | dstB = (srcB * dstB) / 255; |
1479 | break; |
1480 | case SDL_COPY_MUL: |
1481 | dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255; |
1482 | dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255; |
1483 | dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255; |
1484 | break; |
1485 | } |
1486 | dstpixel = (dstR << 16) | (dstG << 8) | dstB; |
1487 | *dst = dstpixel; |
1488 | posx += incx; |
1489 | ++dst; |
1490 | } |
1491 | posy += incy; |
1492 | info->dst += info->dst_pitch; |
1493 | } |
1494 | } |
1495 | |
1496 | static void SDL_Blit_BGR888_BGR888_Scale(SDL_BlitInfo *info) |
1497 | { |
1498 | int srcy, srcx; |
1499 | Uint32 posy, posx; |
1500 | int incy, incx; |
1501 | |
1502 | incy = (info->src_h << 16) / info->dst_h; |
1503 | incx = (info->src_w << 16) / info->dst_w; |
1504 | posy = incy / 2; |
1505 | |
1506 | while (info->dst_h--) { |
1507 | Uint32 *src = 0; |
1508 | Uint32 *dst = (Uint32 *)info->dst; |
1509 | int n = info->dst_w; |
1510 | posx = incx / 2; |
1511 | |
1512 | srcy = posy >> 16; |
1513 | while (n--) { |
1514 | srcx = posx >> 16; |
1515 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
1516 | *dst = *src; |
1517 | posx += incx; |
1518 | ++dst; |
1519 | } |
1520 | posy += incy; |
1521 | info->dst += info->dst_pitch; |
1522 | } |
1523 | } |
1524 | |
1525 | static void SDL_Blit_BGR888_BGR888_Blend(SDL_BlitInfo *info) |
1526 | { |
1527 | const int flags = info->flags; |
1528 | Uint32 srcpixel; |
1529 | Uint32 srcR, srcG, srcB; |
1530 | Uint32 dstpixel; |
1531 | Uint32 dstR, dstG, dstB; |
1532 | |
1533 | while (info->dst_h--) { |
1534 | Uint32 *src = (Uint32 *)info->src; |
1535 | Uint32 *dst = (Uint32 *)info->dst; |
1536 | int n = info->dst_w; |
1537 | while (n--) { |
1538 | srcpixel = *src; |
1539 | srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; |
1540 | dstpixel = *dst; |
1541 | dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; |
1542 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
1543 | case SDL_COPY_BLEND: |
1544 | dstR = srcR; |
1545 | dstG = srcG; |
1546 | dstB = srcB; |
1547 | break; |
1548 | case SDL_COPY_ADD: |
1549 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
1550 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
1551 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
1552 | break; |
1553 | case SDL_COPY_MOD: |
1554 | dstR = (srcR * dstR) / 255; |
1555 | dstG = (srcG * dstG) / 255; |
1556 | dstB = (srcB * dstB) / 255; |
1557 | break; |
1558 | case SDL_COPY_MUL: |
1559 | dstR = (srcR * dstR) / 255; |
1560 | dstG = (srcG * dstG) / 255; |
1561 | dstB = (srcB * dstB) / 255; |
1562 | break; |
1563 | } |
1564 | dstpixel = (dstB << 16) | (dstG << 8) | dstR; |
1565 | *dst = dstpixel; |
1566 | ++src; |
1567 | ++dst; |
1568 | } |
1569 | info->src += info->src_pitch; |
1570 | info->dst += info->dst_pitch; |
1571 | } |
1572 | } |
1573 | |
1574 | static void SDL_Blit_BGR888_BGR888_Blend_Scale(SDL_BlitInfo *info) |
1575 | { |
1576 | const int flags = info->flags; |
1577 | Uint32 srcpixel; |
1578 | Uint32 srcR, srcG, srcB; |
1579 | Uint32 dstpixel; |
1580 | Uint32 dstR, dstG, dstB; |
1581 | int srcy, srcx; |
1582 | Uint32 posy, posx; |
1583 | int incy, incx; |
1584 | |
1585 | incy = (info->src_h << 16) / info->dst_h; |
1586 | incx = (info->src_w << 16) / info->dst_w; |
1587 | posy = incy / 2; |
1588 | |
1589 | while (info->dst_h--) { |
1590 | Uint32 *src = 0; |
1591 | Uint32 *dst = (Uint32 *)info->dst; |
1592 | int n = info->dst_w; |
1593 | posx = incx / 2; |
1594 | |
1595 | srcy = posy >> 16; |
1596 | while (n--) { |
1597 | srcx = posx >> 16; |
1598 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
1599 | srcpixel = *src; |
1600 | srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; |
1601 | dstpixel = *dst; |
1602 | dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; |
1603 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
1604 | case SDL_COPY_BLEND: |
1605 | dstR = srcR; |
1606 | dstG = srcG; |
1607 | dstB = srcB; |
1608 | break; |
1609 | case SDL_COPY_ADD: |
1610 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
1611 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
1612 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
1613 | break; |
1614 | case SDL_COPY_MOD: |
1615 | dstR = (srcR * dstR) / 255; |
1616 | dstG = (srcG * dstG) / 255; |
1617 | dstB = (srcB * dstB) / 255; |
1618 | break; |
1619 | case SDL_COPY_MUL: |
1620 | dstR = (srcR * dstR) / 255; |
1621 | dstG = (srcG * dstG) / 255; |
1622 | dstB = (srcB * dstB) / 255; |
1623 | break; |
1624 | } |
1625 | dstpixel = (dstB << 16) | (dstG << 8) | dstR; |
1626 | *dst = dstpixel; |
1627 | posx += incx; |
1628 | ++dst; |
1629 | } |
1630 | posy += incy; |
1631 | info->dst += info->dst_pitch; |
1632 | } |
1633 | } |
1634 | |
1635 | static void SDL_Blit_BGR888_BGR888_Modulate(SDL_BlitInfo *info) |
1636 | { |
1637 | const int flags = info->flags; |
1638 | const Uint32 modulateR = info->r; |
1639 | const Uint32 modulateG = info->g; |
1640 | const Uint32 modulateB = info->b; |
1641 | Uint32 pixel; |
1642 | Uint32 R, G, B; |
1643 | |
1644 | while (info->dst_h--) { |
1645 | Uint32 *src = (Uint32 *)info->src; |
1646 | Uint32 *dst = (Uint32 *)info->dst; |
1647 | int n = info->dst_w; |
1648 | while (n--) { |
1649 | pixel = *src; |
1650 | B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; |
1651 | if (flags & SDL_COPY_MODULATE_COLOR) { |
1652 | R = (R * modulateR) / 255; |
1653 | G = (G * modulateG) / 255; |
1654 | B = (B * modulateB) / 255; |
1655 | } |
1656 | pixel = (B << 16) | (G << 8) | R; |
1657 | *dst = pixel; |
1658 | ++src; |
1659 | ++dst; |
1660 | } |
1661 | info->src += info->src_pitch; |
1662 | info->dst += info->dst_pitch; |
1663 | } |
1664 | } |
1665 | |
1666 | static void SDL_Blit_BGR888_BGR888_Modulate_Scale(SDL_BlitInfo *info) |
1667 | { |
1668 | const int flags = info->flags; |
1669 | const Uint32 modulateR = info->r; |
1670 | const Uint32 modulateG = info->g; |
1671 | const Uint32 modulateB = info->b; |
1672 | Uint32 pixel; |
1673 | Uint32 R, G, B; |
1674 | int srcy, srcx; |
1675 | Uint32 posy, posx; |
1676 | int incy, incx; |
1677 | |
1678 | incy = (info->src_h << 16) / info->dst_h; |
1679 | incx = (info->src_w << 16) / info->dst_w; |
1680 | posy = incy / 2; |
1681 | |
1682 | while (info->dst_h--) { |
1683 | Uint32 *src = 0; |
1684 | Uint32 *dst = (Uint32 *)info->dst; |
1685 | int n = info->dst_w; |
1686 | posx = incx / 2; |
1687 | |
1688 | srcy = posy >> 16; |
1689 | while (n--) { |
1690 | srcx = posx >> 16; |
1691 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
1692 | pixel = *src; |
1693 | B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; |
1694 | if (flags & SDL_COPY_MODULATE_COLOR) { |
1695 | R = (R * modulateR) / 255; |
1696 | G = (G * modulateG) / 255; |
1697 | B = (B * modulateB) / 255; |
1698 | } |
1699 | pixel = (B << 16) | (G << 8) | R; |
1700 | *dst = pixel; |
1701 | posx += incx; |
1702 | ++dst; |
1703 | } |
1704 | posy += incy; |
1705 | info->dst += info->dst_pitch; |
1706 | } |
1707 | } |
1708 | |
1709 | static void SDL_Blit_BGR888_BGR888_Modulate_Blend(SDL_BlitInfo *info) |
1710 | { |
1711 | const int flags = info->flags; |
1712 | const Uint32 modulateR = info->r; |
1713 | const Uint32 modulateG = info->g; |
1714 | const Uint32 modulateB = info->b; |
1715 | const Uint32 modulateA = info->a; |
1716 | Uint32 srcpixel; |
1717 | const Uint32 srcA = (flags & SDL_COPY_MODULATE_ALPHA) ? modulateA : 0xFF; |
1718 | Uint32 srcR, srcG, srcB; |
1719 | Uint32 dstpixel; |
1720 | Uint32 dstR, dstG, dstB; |
1721 | |
1722 | while (info->dst_h--) { |
1723 | Uint32 *src = (Uint32 *)info->src; |
1724 | Uint32 *dst = (Uint32 *)info->dst; |
1725 | int n = info->dst_w; |
1726 | while (n--) { |
1727 | srcpixel = *src; |
1728 | srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; |
1729 | dstpixel = *dst; |
1730 | dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; |
1731 | if (flags & SDL_COPY_MODULATE_COLOR) { |
1732 | srcR = (srcR * modulateR) / 255; |
1733 | srcG = (srcG * modulateG) / 255; |
1734 | srcB = (srcB * modulateB) / 255; |
1735 | } |
1736 | if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
1737 | /* This goes away if we ever use premultiplied alpha */ |
1738 | if (srcA < 255) { |
1739 | srcR = (srcR * srcA) / 255; |
1740 | srcG = (srcG * srcA) / 255; |
1741 | srcB = (srcB * srcA) / 255; |
1742 | } |
1743 | } |
1744 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
1745 | case SDL_COPY_BLEND: |
1746 | dstR = srcR + ((255 - srcA) * dstR) / 255; |
1747 | dstG = srcG + ((255 - srcA) * dstG) / 255; |
1748 | dstB = srcB + ((255 - srcA) * dstB) / 255; |
1749 | break; |
1750 | case SDL_COPY_ADD: |
1751 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
1752 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
1753 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
1754 | break; |
1755 | case SDL_COPY_MOD: |
1756 | dstR = (srcR * dstR) / 255; |
1757 | dstG = (srcG * dstG) / 255; |
1758 | dstB = (srcB * dstB) / 255; |
1759 | break; |
1760 | case SDL_COPY_MUL: |
1761 | dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255; |
1762 | dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255; |
1763 | dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255; |
1764 | break; |
1765 | } |
1766 | dstpixel = (dstB << 16) | (dstG << 8) | dstR; |
1767 | *dst = dstpixel; |
1768 | ++src; |
1769 | ++dst; |
1770 | } |
1771 | info->src += info->src_pitch; |
1772 | info->dst += info->dst_pitch; |
1773 | } |
1774 | } |
1775 | |
1776 | static void SDL_Blit_BGR888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info) |
1777 | { |
1778 | const int flags = info->flags; |
1779 | const Uint32 modulateR = info->r; |
1780 | const Uint32 modulateG = info->g; |
1781 | const Uint32 modulateB = info->b; |
1782 | const Uint32 modulateA = info->a; |
1783 | Uint32 srcpixel; |
1784 | const Uint32 srcA = (flags & SDL_COPY_MODULATE_ALPHA) ? modulateA : 0xFF; |
1785 | Uint32 srcR, srcG, srcB; |
1786 | Uint32 dstpixel; |
1787 | Uint32 dstR, dstG, dstB; |
1788 | int srcy, srcx; |
1789 | Uint32 posy, posx; |
1790 | int incy, incx; |
1791 | |
1792 | incy = (info->src_h << 16) / info->dst_h; |
1793 | incx = (info->src_w << 16) / info->dst_w; |
1794 | posy = incy / 2; |
1795 | |
1796 | while (info->dst_h--) { |
1797 | Uint32 *src = 0; |
1798 | Uint32 *dst = (Uint32 *)info->dst; |
1799 | int n = info->dst_w; |
1800 | posx = incx / 2; |
1801 | |
1802 | srcy = posy >> 16; |
1803 | while (n--) { |
1804 | srcx = posx >> 16; |
1805 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
1806 | srcpixel = *src; |
1807 | srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; |
1808 | dstpixel = *dst; |
1809 | dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; |
1810 | if (flags & SDL_COPY_MODULATE_COLOR) { |
1811 | srcR = (srcR * modulateR) / 255; |
1812 | srcG = (srcG * modulateG) / 255; |
1813 | srcB = (srcB * modulateB) / 255; |
1814 | } |
1815 | if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
1816 | /* This goes away if we ever use premultiplied alpha */ |
1817 | if (srcA < 255) { |
1818 | srcR = (srcR * srcA) / 255; |
1819 | srcG = (srcG * srcA) / 255; |
1820 | srcB = (srcB * srcA) / 255; |
1821 | } |
1822 | } |
1823 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
1824 | case SDL_COPY_BLEND: |
1825 | dstR = srcR + ((255 - srcA) * dstR) / 255; |
1826 | dstG = srcG + ((255 - srcA) * dstG) / 255; |
1827 | dstB = srcB + ((255 - srcA) * dstB) / 255; |
1828 | break; |
1829 | case SDL_COPY_ADD: |
1830 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
1831 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
1832 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
1833 | break; |
1834 | case SDL_COPY_MOD: |
1835 | dstR = (srcR * dstR) / 255; |
1836 | dstG = (srcG * dstG) / 255; |
1837 | dstB = (srcB * dstB) / 255; |
1838 | break; |
1839 | case SDL_COPY_MUL: |
1840 | dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255; |
1841 | dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255; |
1842 | dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255; |
1843 | break; |
1844 | } |
1845 | dstpixel = (dstB << 16) | (dstG << 8) | dstR; |
1846 | *dst = dstpixel; |
1847 | posx += incx; |
1848 | ++dst; |
1849 | } |
1850 | posy += incy; |
1851 | info->dst += info->dst_pitch; |
1852 | } |
1853 | } |
1854 | |
1855 | static void SDL_Blit_BGR888_ARGB8888_Scale(SDL_BlitInfo *info) |
1856 | { |
1857 | Uint32 pixel; |
1858 | const Uint32 A = 0xFF; |
1859 | Uint32 R, G, B; |
1860 | int srcy, srcx; |
1861 | Uint32 posy, posx; |
1862 | int incy, incx; |
1863 | |
1864 | incy = (info->src_h << 16) / info->dst_h; |
1865 | incx = (info->src_w << 16) / info->dst_w; |
1866 | posy = incy / 2; |
1867 | |
1868 | while (info->dst_h--) { |
1869 | Uint32 *src = 0; |
1870 | Uint32 *dst = (Uint32 *)info->dst; |
1871 | int n = info->dst_w; |
1872 | posx = incx / 2; |
1873 | |
1874 | srcy = posy >> 16; |
1875 | while (n--) { |
1876 | srcx = posx >> 16; |
1877 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
1878 | pixel = *src; |
1879 | B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; |
1880 | pixel = (A << 24) | (R << 16) | (G << 8) | B; |
1881 | *dst = pixel; |
1882 | posx += incx; |
1883 | ++dst; |
1884 | } |
1885 | posy += incy; |
1886 | info->dst += info->dst_pitch; |
1887 | } |
1888 | } |
1889 | |
1890 | static void SDL_Blit_BGR888_ARGB8888_Blend(SDL_BlitInfo *info) |
1891 | { |
1892 | const int flags = info->flags; |
1893 | Uint32 srcpixel; |
1894 | Uint32 srcR, srcG, srcB; |
1895 | Uint32 dstpixel; |
1896 | Uint32 dstR, dstG, dstB, dstA; |
1897 | |
1898 | while (info->dst_h--) { |
1899 | Uint32 *src = (Uint32 *)info->src; |
1900 | Uint32 *dst = (Uint32 *)info->dst; |
1901 | int n = info->dst_w; |
1902 | while (n--) { |
1903 | srcpixel = *src; |
1904 | srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; |
1905 | dstpixel = *dst; |
1906 | dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24); |
1907 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
1908 | case SDL_COPY_BLEND: |
1909 | dstR = srcR; |
1910 | dstG = srcG; |
1911 | dstB = srcB; |
1912 | dstA = 0xFF; |
1913 | break; |
1914 | case SDL_COPY_ADD: |
1915 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
1916 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
1917 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
1918 | break; |
1919 | case SDL_COPY_MOD: |
1920 | dstR = (srcR * dstR) / 255; |
1921 | dstG = (srcG * dstG) / 255; |
1922 | dstB = (srcB * dstB) / 255; |
1923 | break; |
1924 | case SDL_COPY_MUL: |
1925 | dstR = (srcR * dstR) / 255; |
1926 | dstG = (srcG * dstG) / 255; |
1927 | dstB = (srcB * dstB) / 255; |
1928 | dstA = 0xFF; |
1929 | break; |
1930 | } |
1931 | dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB; |
1932 | *dst = dstpixel; |
1933 | ++src; |
1934 | ++dst; |
1935 | } |
1936 | info->src += info->src_pitch; |
1937 | info->dst += info->dst_pitch; |
1938 | } |
1939 | } |
1940 | |
1941 | static void SDL_Blit_BGR888_ARGB8888_Blend_Scale(SDL_BlitInfo *info) |
1942 | { |
1943 | const int flags = info->flags; |
1944 | Uint32 srcpixel; |
1945 | Uint32 srcR, srcG, srcB; |
1946 | Uint32 dstpixel; |
1947 | Uint32 dstR, dstG, dstB, dstA; |
1948 | int srcy, srcx; |
1949 | Uint32 posy, posx; |
1950 | int incy, incx; |
1951 | |
1952 | incy = (info->src_h << 16) / info->dst_h; |
1953 | incx = (info->src_w << 16) / info->dst_w; |
1954 | posy = incy / 2; |
1955 | |
1956 | while (info->dst_h--) { |
1957 | Uint32 *src = 0; |
1958 | Uint32 *dst = (Uint32 *)info->dst; |
1959 | int n = info->dst_w; |
1960 | posx = incx / 2; |
1961 | |
1962 | srcy = posy >> 16; |
1963 | while (n--) { |
1964 | srcx = posx >> 16; |
1965 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
1966 | srcpixel = *src; |
1967 | srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; |
1968 | dstpixel = *dst; |
1969 | dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24); |
1970 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
1971 | case SDL_COPY_BLEND: |
1972 | dstR = srcR; |
1973 | dstG = srcG; |
1974 | dstB = srcB; |
1975 | dstA = 0xFF; |
1976 | break; |
1977 | case SDL_COPY_ADD: |
1978 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
1979 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
1980 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
1981 | break; |
1982 | case SDL_COPY_MOD: |
1983 | dstR = (srcR * dstR) / 255; |
1984 | dstG = (srcG * dstG) / 255; |
1985 | dstB = (srcB * dstB) / 255; |
1986 | break; |
1987 | case SDL_COPY_MUL: |
1988 | dstR = (srcR * dstR) / 255; |
1989 | dstG = (srcG * dstG) / 255; |
1990 | dstB = (srcB * dstB) / 255; |
1991 | dstA = 0xFF; |
1992 | break; |
1993 | } |
1994 | dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB; |
1995 | *dst = dstpixel; |
1996 | posx += incx; |
1997 | ++dst; |
1998 | } |
1999 | posy += incy; |
2000 | info->dst += info->dst_pitch; |
2001 | } |
2002 | } |
2003 | |
2004 | static void SDL_Blit_BGR888_ARGB8888_Modulate(SDL_BlitInfo *info) |
2005 | { |
2006 | const int flags = info->flags; |
2007 | const Uint32 modulateR = info->r; |
2008 | const Uint32 modulateG = info->g; |
2009 | const Uint32 modulateB = info->b; |
2010 | const Uint32 modulateA = info->a; |
2011 | Uint32 pixel; |
2012 | const Uint32 A = (flags & SDL_COPY_MODULATE_ALPHA) ? modulateA : 0xFF; |
2013 | Uint32 R, G, B; |
2014 | |
2015 | while (info->dst_h--) { |
2016 | Uint32 *src = (Uint32 *)info->src; |
2017 | Uint32 *dst = (Uint32 *)info->dst; |
2018 | int n = info->dst_w; |
2019 | while (n--) { |
2020 | pixel = *src; |
2021 | B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; |
2022 | if (flags & SDL_COPY_MODULATE_COLOR) { |
2023 | R = (R * modulateR) / 255; |
2024 | G = (G * modulateG) / 255; |
2025 | B = (B * modulateB) / 255; |
2026 | } |
2027 | pixel = (A << 24) | (R << 16) | (G << 8) | B; |
2028 | *dst = pixel; |
2029 | ++src; |
2030 | ++dst; |
2031 | } |
2032 | info->src += info->src_pitch; |
2033 | info->dst += info->dst_pitch; |
2034 | } |
2035 | } |
2036 | |
2037 | static void SDL_Blit_BGR888_ARGB8888_Modulate_Scale(SDL_BlitInfo *info) |
2038 | { |
2039 | const int flags = info->flags; |
2040 | const Uint32 modulateR = info->r; |
2041 | const Uint32 modulateG = info->g; |
2042 | const Uint32 modulateB = info->b; |
2043 | const Uint32 modulateA = info->a; |
2044 | Uint32 pixel; |
2045 | const Uint32 A = (flags & SDL_COPY_MODULATE_ALPHA) ? modulateA : 0xFF; |
2046 | Uint32 R, G, B; |
2047 | int srcy, srcx; |
2048 | Uint32 posy, posx; |
2049 | int incy, incx; |
2050 | |
2051 | incy = (info->src_h << 16) / info->dst_h; |
2052 | incx = (info->src_w << 16) / info->dst_w; |
2053 | posy = incy / 2; |
2054 | |
2055 | while (info->dst_h--) { |
2056 | Uint32 *src = 0; |
2057 | Uint32 *dst = (Uint32 *)info->dst; |
2058 | int n = info->dst_w; |
2059 | posx = incx / 2; |
2060 | |
2061 | srcy = posy >> 16; |
2062 | while (n--) { |
2063 | srcx = posx >> 16; |
2064 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
2065 | pixel = *src; |
2066 | B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; |
2067 | if (flags & SDL_COPY_MODULATE_COLOR) { |
2068 | R = (R * modulateR) / 255; |
2069 | G = (G * modulateG) / 255; |
2070 | B = (B * modulateB) / 255; |
2071 | } |
2072 | pixel = (A << 24) | (R << 16) | (G << 8) | B; |
2073 | *dst = pixel; |
2074 | posx += incx; |
2075 | ++dst; |
2076 | } |
2077 | posy += incy; |
2078 | info->dst += info->dst_pitch; |
2079 | } |
2080 | } |
2081 | |
2082 | static void SDL_Blit_BGR888_ARGB8888_Modulate_Blend(SDL_BlitInfo *info) |
2083 | { |
2084 | const int flags = info->flags; |
2085 | const Uint32 modulateR = info->r; |
2086 | const Uint32 modulateG = info->g; |
2087 | const Uint32 modulateB = info->b; |
2088 | const Uint32 modulateA = info->a; |
2089 | Uint32 srcpixel; |
2090 | const Uint32 srcA = (flags & SDL_COPY_MODULATE_ALPHA) ? modulateA : 0xFF; |
2091 | Uint32 srcR, srcG, srcB; |
2092 | Uint32 dstpixel; |
2093 | Uint32 dstR, dstG, dstB, dstA; |
2094 | |
2095 | while (info->dst_h--) { |
2096 | Uint32 *src = (Uint32 *)info->src; |
2097 | Uint32 *dst = (Uint32 *)info->dst; |
2098 | int n = info->dst_w; |
2099 | while (n--) { |
2100 | srcpixel = *src; |
2101 | srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; |
2102 | dstpixel = *dst; |
2103 | dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24); |
2104 | if (flags & SDL_COPY_MODULATE_COLOR) { |
2105 | srcR = (srcR * modulateR) / 255; |
2106 | srcG = (srcG * modulateG) / 255; |
2107 | srcB = (srcB * modulateB) / 255; |
2108 | } |
2109 | if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2110 | /* This goes away if we ever use premultiplied alpha */ |
2111 | if (srcA < 255) { |
2112 | srcR = (srcR * srcA) / 255; |
2113 | srcG = (srcG * srcA) / 255; |
2114 | srcB = (srcB * srcA) / 255; |
2115 | } |
2116 | } |
2117 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
2118 | case SDL_COPY_BLEND: |
2119 | dstR = srcR + ((255 - srcA) * dstR) / 255; |
2120 | dstG = srcG + ((255 - srcA) * dstG) / 255; |
2121 | dstB = srcB + ((255 - srcA) * dstB) / 255; |
2122 | dstA = srcA + ((255 - srcA) * dstA) / 255; |
2123 | break; |
2124 | case SDL_COPY_ADD: |
2125 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
2126 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
2127 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
2128 | break; |
2129 | case SDL_COPY_MOD: |
2130 | dstR = (srcR * dstR) / 255; |
2131 | dstG = (srcG * dstG) / 255; |
2132 | dstB = (srcB * dstB) / 255; |
2133 | break; |
2134 | case SDL_COPY_MUL: |
2135 | dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255; |
2136 | dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255; |
2137 | dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255; |
2138 | dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) dstA = 255; |
2139 | break; |
2140 | } |
2141 | dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB; |
2142 | *dst = dstpixel; |
2143 | ++src; |
2144 | ++dst; |
2145 | } |
2146 | info->src += info->src_pitch; |
2147 | info->dst += info->dst_pitch; |
2148 | } |
2149 | } |
2150 | |
2151 | static void SDL_Blit_BGR888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info) |
2152 | { |
2153 | const int flags = info->flags; |
2154 | const Uint32 modulateR = info->r; |
2155 | const Uint32 modulateG = info->g; |
2156 | const Uint32 modulateB = info->b; |
2157 | const Uint32 modulateA = info->a; |
2158 | Uint32 srcpixel; |
2159 | const Uint32 srcA = (flags & SDL_COPY_MODULATE_ALPHA) ? modulateA : 0xFF; |
2160 | Uint32 srcR, srcG, srcB; |
2161 | Uint32 dstpixel; |
2162 | Uint32 dstR, dstG, dstB, dstA; |
2163 | int srcy, srcx; |
2164 | Uint32 posy, posx; |
2165 | int incy, incx; |
2166 | |
2167 | incy = (info->src_h << 16) / info->dst_h; |
2168 | incx = (info->src_w << 16) / info->dst_w; |
2169 | posy = incy / 2; |
2170 | |
2171 | while (info->dst_h--) { |
2172 | Uint32 *src = 0; |
2173 | Uint32 *dst = (Uint32 *)info->dst; |
2174 | int n = info->dst_w; |
2175 | posx = incx / 2; |
2176 | |
2177 | srcy = posy >> 16; |
2178 | while (n--) { |
2179 | srcx = posx >> 16; |
2180 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
2181 | srcpixel = *src; |
2182 | srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; |
2183 | dstpixel = *dst; |
2184 | dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24); |
2185 | if (flags & SDL_COPY_MODULATE_COLOR) { |
2186 | srcR = (srcR * modulateR) / 255; |
2187 | srcG = (srcG * modulateG) / 255; |
2188 | srcB = (srcB * modulateB) / 255; |
2189 | } |
2190 | if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2191 | /* This goes away if we ever use premultiplied alpha */ |
2192 | if (srcA < 255) { |
2193 | srcR = (srcR * srcA) / 255; |
2194 | srcG = (srcG * srcA) / 255; |
2195 | srcB = (srcB * srcA) / 255; |
2196 | } |
2197 | } |
2198 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
2199 | case SDL_COPY_BLEND: |
2200 | dstR = srcR + ((255 - srcA) * dstR) / 255; |
2201 | dstG = srcG + ((255 - srcA) * dstG) / 255; |
2202 | dstB = srcB + ((255 - srcA) * dstB) / 255; |
2203 | dstA = srcA + ((255 - srcA) * dstA) / 255; |
2204 | break; |
2205 | case SDL_COPY_ADD: |
2206 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
2207 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
2208 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
2209 | break; |
2210 | case SDL_COPY_MOD: |
2211 | dstR = (srcR * dstR) / 255; |
2212 | dstG = (srcG * dstG) / 255; |
2213 | dstB = (srcB * dstB) / 255; |
2214 | break; |
2215 | case SDL_COPY_MUL: |
2216 | dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255; |
2217 | dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255; |
2218 | dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255; |
2219 | dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) dstA = 255; |
2220 | break; |
2221 | } |
2222 | dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB; |
2223 | *dst = dstpixel; |
2224 | posx += incx; |
2225 | ++dst; |
2226 | } |
2227 | posy += incy; |
2228 | info->dst += info->dst_pitch; |
2229 | } |
2230 | } |
2231 | |
2232 | static void SDL_Blit_ARGB8888_RGB888_Scale(SDL_BlitInfo *info) |
2233 | { |
2234 | Uint32 pixel; |
2235 | Uint32 R, G, B; |
2236 | int srcy, srcx; |
2237 | Uint32 posy, posx; |
2238 | int incy, incx; |
2239 | |
2240 | incy = (info->src_h << 16) / info->dst_h; |
2241 | incx = (info->src_w << 16) / info->dst_w; |
2242 | posy = incy / 2; |
2243 | |
2244 | while (info->dst_h--) { |
2245 | Uint32 *src = 0; |
2246 | Uint32 *dst = (Uint32 *)info->dst; |
2247 | int n = info->dst_w; |
2248 | posx = incx / 2; |
2249 | |
2250 | srcy = posy >> 16; |
2251 | while (n--) { |
2252 | srcx = posx >> 16; |
2253 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
2254 | pixel = *src; |
2255 | R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; |
2256 | pixel = (R << 16) | (G << 8) | B; |
2257 | *dst = pixel; |
2258 | posx += incx; |
2259 | ++dst; |
2260 | } |
2261 | posy += incy; |
2262 | info->dst += info->dst_pitch; |
2263 | } |
2264 | } |
2265 | |
2266 | static void SDL_Blit_ARGB8888_RGB888_Blend(SDL_BlitInfo *info) |
2267 | { |
2268 | const int flags = info->flags; |
2269 | Uint32 srcpixel; |
2270 | Uint32 srcR, srcG, srcB, srcA; |
2271 | Uint32 dstpixel; |
2272 | Uint32 dstR, dstG, dstB; |
2273 | |
2274 | while (info->dst_h--) { |
2275 | Uint32 *src = (Uint32 *)info->src; |
2276 | Uint32 *dst = (Uint32 *)info->dst; |
2277 | int n = info->dst_w; |
2278 | while (n--) { |
2279 | srcpixel = *src; |
2280 | srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24); |
2281 | dstpixel = *dst; |
2282 | dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; |
2283 | if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2284 | /* This goes away if we ever use premultiplied alpha */ |
2285 | if (srcA < 255) { |
2286 | srcR = (srcR * srcA) / 255; |
2287 | srcG = (srcG * srcA) / 255; |
2288 | srcB = (srcB * srcA) / 255; |
2289 | } |
2290 | } |
2291 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
2292 | case SDL_COPY_BLEND: |
2293 | dstR = srcR + ((255 - srcA) * dstR) / 255; |
2294 | dstG = srcG + ((255 - srcA) * dstG) / 255; |
2295 | dstB = srcB + ((255 - srcA) * dstB) / 255; |
2296 | break; |
2297 | case SDL_COPY_ADD: |
2298 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
2299 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
2300 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
2301 | break; |
2302 | case SDL_COPY_MOD: |
2303 | dstR = (srcR * dstR) / 255; |
2304 | dstG = (srcG * dstG) / 255; |
2305 | dstB = (srcB * dstB) / 255; |
2306 | break; |
2307 | case SDL_COPY_MUL: |
2308 | dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255; |
2309 | dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255; |
2310 | dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255; |
2311 | break; |
2312 | } |
2313 | dstpixel = (dstR << 16) | (dstG << 8) | dstB; |
2314 | *dst = dstpixel; |
2315 | ++src; |
2316 | ++dst; |
2317 | } |
2318 | info->src += info->src_pitch; |
2319 | info->dst += info->dst_pitch; |
2320 | } |
2321 | } |
2322 | |
2323 | static void SDL_Blit_ARGB8888_RGB888_Blend_Scale(SDL_BlitInfo *info) |
2324 | { |
2325 | const int flags = info->flags; |
2326 | Uint32 srcpixel; |
2327 | Uint32 srcR, srcG, srcB, srcA; |
2328 | Uint32 dstpixel; |
2329 | Uint32 dstR, dstG, dstB; |
2330 | int srcy, srcx; |
2331 | Uint32 posy, posx; |
2332 | int incy, incx; |
2333 | |
2334 | incy = (info->src_h << 16) / info->dst_h; |
2335 | incx = (info->src_w << 16) / info->dst_w; |
2336 | posy = incy / 2; |
2337 | |
2338 | while (info->dst_h--) { |
2339 | Uint32 *src = 0; |
2340 | Uint32 *dst = (Uint32 *)info->dst; |
2341 | int n = info->dst_w; |
2342 | posx = incx / 2; |
2343 | |
2344 | srcy = posy >> 16; |
2345 | while (n--) { |
2346 | srcx = posx >> 16; |
2347 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
2348 | srcpixel = *src; |
2349 | srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24); |
2350 | dstpixel = *dst; |
2351 | dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; |
2352 | if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2353 | /* This goes away if we ever use premultiplied alpha */ |
2354 | if (srcA < 255) { |
2355 | srcR = (srcR * srcA) / 255; |
2356 | srcG = (srcG * srcA) / 255; |
2357 | srcB = (srcB * srcA) / 255; |
2358 | } |
2359 | } |
2360 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
2361 | case SDL_COPY_BLEND: |
2362 | dstR = srcR + ((255 - srcA) * dstR) / 255; |
2363 | dstG = srcG + ((255 - srcA) * dstG) / 255; |
2364 | dstB = srcB + ((255 - srcA) * dstB) / 255; |
2365 | break; |
2366 | case SDL_COPY_ADD: |
2367 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
2368 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
2369 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
2370 | break; |
2371 | case SDL_COPY_MOD: |
2372 | dstR = (srcR * dstR) / 255; |
2373 | dstG = (srcG * dstG) / 255; |
2374 | dstB = (srcB * dstB) / 255; |
2375 | break; |
2376 | case SDL_COPY_MUL: |
2377 | dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255; |
2378 | dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255; |
2379 | dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255; |
2380 | break; |
2381 | } |
2382 | dstpixel = (dstR << 16) | (dstG << 8) | dstB; |
2383 | *dst = dstpixel; |
2384 | posx += incx; |
2385 | ++dst; |
2386 | } |
2387 | posy += incy; |
2388 | info->dst += info->dst_pitch; |
2389 | } |
2390 | } |
2391 | |
2392 | static void SDL_Blit_ARGB8888_RGB888_Modulate(SDL_BlitInfo *info) |
2393 | { |
2394 | const int flags = info->flags; |
2395 | const Uint32 modulateR = info->r; |
2396 | const Uint32 modulateG = info->g; |
2397 | const Uint32 modulateB = info->b; |
2398 | Uint32 pixel; |
2399 | Uint32 R, G, B; |
2400 | |
2401 | while (info->dst_h--) { |
2402 | Uint32 *src = (Uint32 *)info->src; |
2403 | Uint32 *dst = (Uint32 *)info->dst; |
2404 | int n = info->dst_w; |
2405 | while (n--) { |
2406 | pixel = *src; |
2407 | R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; |
2408 | if (flags & SDL_COPY_MODULATE_COLOR) { |
2409 | R = (R * modulateR) / 255; |
2410 | G = (G * modulateG) / 255; |
2411 | B = (B * modulateB) / 255; |
2412 | } |
2413 | pixel = (R << 16) | (G << 8) | B; |
2414 | *dst = pixel; |
2415 | ++src; |
2416 | ++dst; |
2417 | } |
2418 | info->src += info->src_pitch; |
2419 | info->dst += info->dst_pitch; |
2420 | } |
2421 | } |
2422 | |
2423 | static void SDL_Blit_ARGB8888_RGB888_Modulate_Scale(SDL_BlitInfo *info) |
2424 | { |
2425 | const int flags = info->flags; |
2426 | const Uint32 modulateR = info->r; |
2427 | const Uint32 modulateG = info->g; |
2428 | const Uint32 modulateB = info->b; |
2429 | Uint32 pixel; |
2430 | Uint32 R, G, B; |
2431 | int srcy, srcx; |
2432 | Uint32 posy, posx; |
2433 | int incy, incx; |
2434 | |
2435 | incy = (info->src_h << 16) / info->dst_h; |
2436 | incx = (info->src_w << 16) / info->dst_w; |
2437 | posy = incy / 2; |
2438 | |
2439 | while (info->dst_h--) { |
2440 | Uint32 *src = 0; |
2441 | Uint32 *dst = (Uint32 *)info->dst; |
2442 | int n = info->dst_w; |
2443 | posx = incx / 2; |
2444 | |
2445 | srcy = posy >> 16; |
2446 | while (n--) { |
2447 | srcx = posx >> 16; |
2448 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
2449 | pixel = *src; |
2450 | R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; |
2451 | if (flags & SDL_COPY_MODULATE_COLOR) { |
2452 | R = (R * modulateR) / 255; |
2453 | G = (G * modulateG) / 255; |
2454 | B = (B * modulateB) / 255; |
2455 | } |
2456 | pixel = (R << 16) | (G << 8) | B; |
2457 | *dst = pixel; |
2458 | posx += incx; |
2459 | ++dst; |
2460 | } |
2461 | posy += incy; |
2462 | info->dst += info->dst_pitch; |
2463 | } |
2464 | } |
2465 | |
2466 | static void SDL_Blit_ARGB8888_RGB888_Modulate_Blend(SDL_BlitInfo *info) |
2467 | { |
2468 | const int flags = info->flags; |
2469 | const Uint32 modulateR = info->r; |
2470 | const Uint32 modulateG = info->g; |
2471 | const Uint32 modulateB = info->b; |
2472 | const Uint32 modulateA = info->a; |
2473 | Uint32 srcpixel; |
2474 | Uint32 srcR, srcG, srcB, srcA; |
2475 | Uint32 dstpixel; |
2476 | Uint32 dstR, dstG, dstB; |
2477 | |
2478 | while (info->dst_h--) { |
2479 | Uint32 *src = (Uint32 *)info->src; |
2480 | Uint32 *dst = (Uint32 *)info->dst; |
2481 | int n = info->dst_w; |
2482 | while (n--) { |
2483 | srcpixel = *src; |
2484 | srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24); |
2485 | dstpixel = *dst; |
2486 | dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; |
2487 | if (flags & SDL_COPY_MODULATE_COLOR) { |
2488 | srcR = (srcR * modulateR) / 255; |
2489 | srcG = (srcG * modulateG) / 255; |
2490 | srcB = (srcB * modulateB) / 255; |
2491 | } |
2492 | if (flags & SDL_COPY_MODULATE_ALPHA) { |
2493 | srcA = (srcA * modulateA) / 255; |
2494 | } |
2495 | if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2496 | /* This goes away if we ever use premultiplied alpha */ |
2497 | if (srcA < 255) { |
2498 | srcR = (srcR * srcA) / 255; |
2499 | srcG = (srcG * srcA) / 255; |
2500 | srcB = (srcB * srcA) / 255; |
2501 | } |
2502 | } |
2503 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
2504 | case SDL_COPY_BLEND: |
2505 | dstR = srcR + ((255 - srcA) * dstR) / 255; |
2506 | dstG = srcG + ((255 - srcA) * dstG) / 255; |
2507 | dstB = srcB + ((255 - srcA) * dstB) / 255; |
2508 | break; |
2509 | case SDL_COPY_ADD: |
2510 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
2511 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
2512 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
2513 | break; |
2514 | case SDL_COPY_MOD: |
2515 | dstR = (srcR * dstR) / 255; |
2516 | dstG = (srcG * dstG) / 255; |
2517 | dstB = (srcB * dstB) / 255; |
2518 | break; |
2519 | case SDL_COPY_MUL: |
2520 | dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255; |
2521 | dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255; |
2522 | dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255; |
2523 | break; |
2524 | } |
2525 | dstpixel = (dstR << 16) | (dstG << 8) | dstB; |
2526 | *dst = dstpixel; |
2527 | ++src; |
2528 | ++dst; |
2529 | } |
2530 | info->src += info->src_pitch; |
2531 | info->dst += info->dst_pitch; |
2532 | } |
2533 | } |
2534 | |
2535 | static void SDL_Blit_ARGB8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info) |
2536 | { |
2537 | const int flags = info->flags; |
2538 | const Uint32 modulateR = info->r; |
2539 | const Uint32 modulateG = info->g; |
2540 | const Uint32 modulateB = info->b; |
2541 | const Uint32 modulateA = info->a; |
2542 | Uint32 srcpixel; |
2543 | Uint32 srcR, srcG, srcB, srcA; |
2544 | Uint32 dstpixel; |
2545 | Uint32 dstR, dstG, dstB; |
2546 | int srcy, srcx; |
2547 | Uint32 posy, posx; |
2548 | int incy, incx; |
2549 | |
2550 | incy = (info->src_h << 16) / info->dst_h; |
2551 | incx = (info->src_w << 16) / info->dst_w; |
2552 | posy = incy / 2; |
2553 | |
2554 | while (info->dst_h--) { |
2555 | Uint32 *src = 0; |
2556 | Uint32 *dst = (Uint32 *)info->dst; |
2557 | int n = info->dst_w; |
2558 | posx = incx / 2; |
2559 | |
2560 | srcy = posy >> 16; |
2561 | while (n--) { |
2562 | srcx = posx >> 16; |
2563 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
2564 | srcpixel = *src; |
2565 | srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24); |
2566 | dstpixel = *dst; |
2567 | dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; |
2568 | if (flags & SDL_COPY_MODULATE_COLOR) { |
2569 | srcR = (srcR * modulateR) / 255; |
2570 | srcG = (srcG * modulateG) / 255; |
2571 | srcB = (srcB * modulateB) / 255; |
2572 | } |
2573 | if (flags & SDL_COPY_MODULATE_ALPHA) { |
2574 | srcA = (srcA * modulateA) / 255; |
2575 | } |
2576 | if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2577 | /* This goes away if we ever use premultiplied alpha */ |
2578 | if (srcA < 255) { |
2579 | srcR = (srcR * srcA) / 255; |
2580 | srcG = (srcG * srcA) / 255; |
2581 | srcB = (srcB * srcA) / 255; |
2582 | } |
2583 | } |
2584 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
2585 | case SDL_COPY_BLEND: |
2586 | dstR = srcR + ((255 - srcA) * dstR) / 255; |
2587 | dstG = srcG + ((255 - srcA) * dstG) / 255; |
2588 | dstB = srcB + ((255 - srcA) * dstB) / 255; |
2589 | break; |
2590 | case SDL_COPY_ADD: |
2591 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
2592 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
2593 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
2594 | break; |
2595 | case SDL_COPY_MOD: |
2596 | dstR = (srcR * dstR) / 255; |
2597 | dstG = (srcG * dstG) / 255; |
2598 | dstB = (srcB * dstB) / 255; |
2599 | break; |
2600 | case SDL_COPY_MUL: |
2601 | dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255; |
2602 | dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255; |
2603 | dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255; |
2604 | break; |
2605 | } |
2606 | dstpixel = (dstR << 16) | (dstG << 8) | dstB; |
2607 | *dst = dstpixel; |
2608 | posx += incx; |
2609 | ++dst; |
2610 | } |
2611 | posy += incy; |
2612 | info->dst += info->dst_pitch; |
2613 | } |
2614 | } |
2615 | |
2616 | static void SDL_Blit_ARGB8888_BGR888_Scale(SDL_BlitInfo *info) |
2617 | { |
2618 | Uint32 pixel; |
2619 | Uint32 R, G, B; |
2620 | int srcy, srcx; |
2621 | Uint32 posy, posx; |
2622 | int incy, incx; |
2623 | |
2624 | incy = (info->src_h << 16) / info->dst_h; |
2625 | incx = (info->src_w << 16) / info->dst_w; |
2626 | posy = incy / 2; |
2627 | |
2628 | while (info->dst_h--) { |
2629 | Uint32 *src = 0; |
2630 | Uint32 *dst = (Uint32 *)info->dst; |
2631 | int n = info->dst_w; |
2632 | posx = incx / 2; |
2633 | |
2634 | srcy = posy >> 16; |
2635 | while (n--) { |
2636 | srcx = posx >> 16; |
2637 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
2638 | pixel = *src; |
2639 | R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; |
2640 | pixel = (B << 16) | (G << 8) | R; |
2641 | *dst = pixel; |
2642 | posx += incx; |
2643 | ++dst; |
2644 | } |
2645 | posy += incy; |
2646 | info->dst += info->dst_pitch; |
2647 | } |
2648 | } |
2649 | |
2650 | static void SDL_Blit_ARGB8888_BGR888_Blend(SDL_BlitInfo *info) |
2651 | { |
2652 | const int flags = info->flags; |
2653 | Uint32 srcpixel; |
2654 | Uint32 srcR, srcG, srcB, srcA; |
2655 | Uint32 dstpixel; |
2656 | Uint32 dstR, dstG, dstB; |
2657 | |
2658 | while (info->dst_h--) { |
2659 | Uint32 *src = (Uint32 *)info->src; |
2660 | Uint32 *dst = (Uint32 *)info->dst; |
2661 | int n = info->dst_w; |
2662 | while (n--) { |
2663 | srcpixel = *src; |
2664 | srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24); |
2665 | dstpixel = *dst; |
2666 | dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; |
2667 | if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2668 | /* This goes away if we ever use premultiplied alpha */ |
2669 | if (srcA < 255) { |
2670 | srcR = (srcR * srcA) / 255; |
2671 | srcG = (srcG * srcA) / 255; |
2672 | srcB = (srcB * srcA) / 255; |
2673 | } |
2674 | } |
2675 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
2676 | case SDL_COPY_BLEND: |
2677 | dstR = srcR + ((255 - srcA) * dstR) / 255; |
2678 | dstG = srcG + ((255 - srcA) * dstG) / 255; |
2679 | dstB = srcB + ((255 - srcA) * dstB) / 255; |
2680 | break; |
2681 | case SDL_COPY_ADD: |
2682 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
2683 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
2684 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
2685 | break; |
2686 | case SDL_COPY_MOD: |
2687 | dstR = (srcR * dstR) / 255; |
2688 | dstG = (srcG * dstG) / 255; |
2689 | dstB = (srcB * dstB) / 255; |
2690 | break; |
2691 | case SDL_COPY_MUL: |
2692 | dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255; |
2693 | dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255; |
2694 | dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255; |
2695 | break; |
2696 | } |
2697 | dstpixel = (dstB << 16) | (dstG << 8) | dstR; |
2698 | *dst = dstpixel; |
2699 | ++src; |
2700 | ++dst; |
2701 | } |
2702 | info->src += info->src_pitch; |
2703 | info->dst += info->dst_pitch; |
2704 | } |
2705 | } |
2706 | |
2707 | static void SDL_Blit_ARGB8888_BGR888_Blend_Scale(SDL_BlitInfo *info) |
2708 | { |
2709 | const int flags = info->flags; |
2710 | Uint32 srcpixel; |
2711 | Uint32 srcR, srcG, srcB, srcA; |
2712 | Uint32 dstpixel; |
2713 | Uint32 dstR, dstG, dstB; |
2714 | int srcy, srcx; |
2715 | Uint32 posy, posx; |
2716 | int incy, incx; |
2717 | |
2718 | incy = (info->src_h << 16) / info->dst_h; |
2719 | incx = (info->src_w << 16) / info->dst_w; |
2720 | posy = incy / 2; |
2721 | |
2722 | while (info->dst_h--) { |
2723 | Uint32 *src = 0; |
2724 | Uint32 *dst = (Uint32 *)info->dst; |
2725 | int n = info->dst_w; |
2726 | posx = incx / 2; |
2727 | |
2728 | srcy = posy >> 16; |
2729 | while (n--) { |
2730 | srcx = posx >> 16; |
2731 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
2732 | srcpixel = *src; |
2733 | srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24); |
2734 | dstpixel = *dst; |
2735 | dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; |
2736 | if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2737 | /* This goes away if we ever use premultiplied alpha */ |
2738 | if (srcA < 255) { |
2739 | srcR = (srcR * srcA) / 255; |
2740 | srcG = (srcG * srcA) / 255; |
2741 | srcB = (srcB * srcA) / 255; |
2742 | } |
2743 | } |
2744 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
2745 | case SDL_COPY_BLEND: |
2746 | dstR = srcR + ((255 - srcA) * dstR) / 255; |
2747 | dstG = srcG + ((255 - srcA) * dstG) / 255; |
2748 | dstB = srcB + ((255 - srcA) * dstB) / 255; |
2749 | break; |
2750 | case SDL_COPY_ADD: |
2751 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
2752 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
2753 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
2754 | break; |
2755 | case SDL_COPY_MOD: |
2756 | dstR = (srcR * dstR) / 255; |
2757 | dstG = (srcG * dstG) / 255; |
2758 | dstB = (srcB * dstB) / 255; |
2759 | break; |
2760 | case SDL_COPY_MUL: |
2761 | dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255; |
2762 | dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255; |
2763 | dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255; |
2764 | break; |
2765 | } |
2766 | dstpixel = (dstB << 16) | (dstG << 8) | dstR; |
2767 | *dst = dstpixel; |
2768 | posx += incx; |
2769 | ++dst; |
2770 | } |
2771 | posy += incy; |
2772 | info->dst += info->dst_pitch; |
2773 | } |
2774 | } |
2775 | |
2776 | static void SDL_Blit_ARGB8888_BGR888_Modulate(SDL_BlitInfo *info) |
2777 | { |
2778 | const int flags = info->flags; |
2779 | const Uint32 modulateR = info->r; |
2780 | const Uint32 modulateG = info->g; |
2781 | const Uint32 modulateB = info->b; |
2782 | Uint32 pixel; |
2783 | Uint32 R, G, B; |
2784 | |
2785 | while (info->dst_h--) { |
2786 | Uint32 *src = (Uint32 *)info->src; |
2787 | Uint32 *dst = (Uint32 *)info->dst; |
2788 | int n = info->dst_w; |
2789 | while (n--) { |
2790 | pixel = *src; |
2791 | R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; |
2792 | if (flags & SDL_COPY_MODULATE_COLOR) { |
2793 | R = (R * modulateR) / 255; |
2794 | G = (G * modulateG) / 255; |
2795 | B = (B * modulateB) / 255; |
2796 | } |
2797 | pixel = (B << 16) | (G << 8) | R; |
2798 | *dst = pixel; |
2799 | ++src; |
2800 | ++dst; |
2801 | } |
2802 | info->src += info->src_pitch; |
2803 | info->dst += info->dst_pitch; |
2804 | } |
2805 | } |
2806 | |
2807 | static void SDL_Blit_ARGB8888_BGR888_Modulate_Scale(SDL_BlitInfo *info) |
2808 | { |
2809 | const int flags = info->flags; |
2810 | const Uint32 modulateR = info->r; |
2811 | const Uint32 modulateG = info->g; |
2812 | const Uint32 modulateB = info->b; |
2813 | Uint32 pixel; |
2814 | Uint32 R, G, B; |
2815 | int srcy, srcx; |
2816 | Uint32 posy, posx; |
2817 | int incy, incx; |
2818 | |
2819 | incy = (info->src_h << 16) / info->dst_h; |
2820 | incx = (info->src_w << 16) / info->dst_w; |
2821 | posy = incy / 2; |
2822 | |
2823 | while (info->dst_h--) { |
2824 | Uint32 *src = 0; |
2825 | Uint32 *dst = (Uint32 *)info->dst; |
2826 | int n = info->dst_w; |
2827 | posx = incx / 2; |
2828 | |
2829 | srcy = posy >> 16; |
2830 | while (n--) { |
2831 | srcx = posx >> 16; |
2832 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
2833 | pixel = *src; |
2834 | R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; |
2835 | if (flags & SDL_COPY_MODULATE_COLOR) { |
2836 | R = (R * modulateR) / 255; |
2837 | G = (G * modulateG) / 255; |
2838 | B = (B * modulateB) / 255; |
2839 | } |
2840 | pixel = (B << 16) | (G << 8) | R; |
2841 | *dst = pixel; |
2842 | posx += incx; |
2843 | ++dst; |
2844 | } |
2845 | posy += incy; |
2846 | info->dst += info->dst_pitch; |
2847 | } |
2848 | } |
2849 | |
2850 | static void SDL_Blit_ARGB8888_BGR888_Modulate_Blend(SDL_BlitInfo *info) |
2851 | { |
2852 | const int flags = info->flags; |
2853 | const Uint32 modulateR = info->r; |
2854 | const Uint32 modulateG = info->g; |
2855 | const Uint32 modulateB = info->b; |
2856 | const Uint32 modulateA = info->a; |
2857 | Uint32 srcpixel; |
2858 | Uint32 srcR, srcG, srcB, srcA; |
2859 | Uint32 dstpixel; |
2860 | Uint32 dstR, dstG, dstB; |
2861 | |
2862 | while (info->dst_h--) { |
2863 | Uint32 *src = (Uint32 *)info->src; |
2864 | Uint32 *dst = (Uint32 *)info->dst; |
2865 | int n = info->dst_w; |
2866 | while (n--) { |
2867 | srcpixel = *src; |
2868 | srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24); |
2869 | dstpixel = *dst; |
2870 | dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; |
2871 | if (flags & SDL_COPY_MODULATE_COLOR) { |
2872 | srcR = (srcR * modulateR) / 255; |
2873 | srcG = (srcG * modulateG) / 255; |
2874 | srcB = (srcB * modulateB) / 255; |
2875 | } |
2876 | if (flags & SDL_COPY_MODULATE_ALPHA) { |
2877 | srcA = (srcA * modulateA) / 255; |
2878 | } |
2879 | if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2880 | /* This goes away if we ever use premultiplied alpha */ |
2881 | if (srcA < 255) { |
2882 | srcR = (srcR * srcA) / 255; |
2883 | srcG = (srcG * srcA) / 255; |
2884 | srcB = (srcB * srcA) / 255; |
2885 | } |
2886 | } |
2887 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
2888 | case SDL_COPY_BLEND: |
2889 | dstR = srcR + ((255 - srcA) * dstR) / 255; |
2890 | dstG = srcG + ((255 - srcA) * dstG) / 255; |
2891 | dstB = srcB + ((255 - srcA) * dstB) / 255; |
2892 | break; |
2893 | case SDL_COPY_ADD: |
2894 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
2895 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
2896 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
2897 | break; |
2898 | case SDL_COPY_MOD: |
2899 | dstR = (srcR * dstR) / 255; |
2900 | dstG = (srcG * dstG) / 255; |
2901 | dstB = (srcB * dstB) / 255; |
2902 | break; |
2903 | case SDL_COPY_MUL: |
2904 | dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255; |
2905 | dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255; |
2906 | dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255; |
2907 | break; |
2908 | } |
2909 | dstpixel = (dstB << 16) | (dstG << 8) | dstR; |
2910 | *dst = dstpixel; |
2911 | ++src; |
2912 | ++dst; |
2913 | } |
2914 | info->src += info->src_pitch; |
2915 | info->dst += info->dst_pitch; |
2916 | } |
2917 | } |
2918 | |
2919 | static void SDL_Blit_ARGB8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info) |
2920 | { |
2921 | const int flags = info->flags; |
2922 | const Uint32 modulateR = info->r; |
2923 | const Uint32 modulateG = info->g; |
2924 | const Uint32 modulateB = info->b; |
2925 | const Uint32 modulateA = info->a; |
2926 | Uint32 srcpixel; |
2927 | Uint32 srcR, srcG, srcB, srcA; |
2928 | Uint32 dstpixel; |
2929 | Uint32 dstR, dstG, dstB; |
2930 | int srcy, srcx; |
2931 | Uint32 posy, posx; |
2932 | int incy, incx; |
2933 | |
2934 | incy = (info->src_h << 16) / info->dst_h; |
2935 | incx = (info->src_w << 16) / info->dst_w; |
2936 | posy = incy / 2; |
2937 | |
2938 | while (info->dst_h--) { |
2939 | Uint32 *src = 0; |
2940 | Uint32 *dst = (Uint32 *)info->dst; |
2941 | int n = info->dst_w; |
2942 | posx = incx / 2; |
2943 | |
2944 | srcy = posy >> 16; |
2945 | while (n--) { |
2946 | srcx = posx >> 16; |
2947 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
2948 | srcpixel = *src; |
2949 | srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24); |
2950 | dstpixel = *dst; |
2951 | dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; |
2952 | if (flags & SDL_COPY_MODULATE_COLOR) { |
2953 | srcR = (srcR * modulateR) / 255; |
2954 | srcG = (srcG * modulateG) / 255; |
2955 | srcB = (srcB * modulateB) / 255; |
2956 | } |
2957 | if (flags & SDL_COPY_MODULATE_ALPHA) { |
2958 | srcA = (srcA * modulateA) / 255; |
2959 | } |
2960 | if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
2961 | /* This goes away if we ever use premultiplied alpha */ |
2962 | if (srcA < 255) { |
2963 | srcR = (srcR * srcA) / 255; |
2964 | srcG = (srcG * srcA) / 255; |
2965 | srcB = (srcB * srcA) / 255; |
2966 | } |
2967 | } |
2968 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
2969 | case SDL_COPY_BLEND: |
2970 | dstR = srcR + ((255 - srcA) * dstR) / 255; |
2971 | dstG = srcG + ((255 - srcA) * dstG) / 255; |
2972 | dstB = srcB + ((255 - srcA) * dstB) / 255; |
2973 | break; |
2974 | case SDL_COPY_ADD: |
2975 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
2976 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
2977 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
2978 | break; |
2979 | case SDL_COPY_MOD: |
2980 | dstR = (srcR * dstR) / 255; |
2981 | dstG = (srcG * dstG) / 255; |
2982 | dstB = (srcB * dstB) / 255; |
2983 | break; |
2984 | case SDL_COPY_MUL: |
2985 | dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255; |
2986 | dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255; |
2987 | dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255; |
2988 | break; |
2989 | } |
2990 | dstpixel = (dstB << 16) | (dstG << 8) | dstR; |
2991 | *dst = dstpixel; |
2992 | posx += incx; |
2993 | ++dst; |
2994 | } |
2995 | posy += incy; |
2996 | info->dst += info->dst_pitch; |
2997 | } |
2998 | } |
2999 | |
3000 | static void SDL_Blit_ARGB8888_ARGB8888_Scale(SDL_BlitInfo *info) |
3001 | { |
3002 | int srcy, srcx; |
3003 | Uint32 posy, posx; |
3004 | int incy, incx; |
3005 | |
3006 | incy = (info->src_h << 16) / info->dst_h; |
3007 | incx = (info->src_w << 16) / info->dst_w; |
3008 | posy = incy / 2; |
3009 | |
3010 | while (info->dst_h--) { |
3011 | Uint32 *src = 0; |
3012 | Uint32 *dst = (Uint32 *)info->dst; |
3013 | int n = info->dst_w; |
3014 | posx = incx / 2; |
3015 | |
3016 | srcy = posy >> 16; |
3017 | while (n--) { |
3018 | srcx = posx >> 16; |
3019 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
3020 | *dst = *src; |
3021 | posx += incx; |
3022 | ++dst; |
3023 | } |
3024 | posy += incy; |
3025 | info->dst += info->dst_pitch; |
3026 | } |
3027 | } |
3028 | |
3029 | static void SDL_Blit_ARGB8888_ARGB8888_Blend(SDL_BlitInfo *info) |
3030 | { |
3031 | const int flags = info->flags; |
3032 | Uint32 srcpixel; |
3033 | Uint32 srcR, srcG, srcB, srcA; |
3034 | Uint32 dstpixel; |
3035 | Uint32 dstR, dstG, dstB, dstA; |
3036 | |
3037 | while (info->dst_h--) { |
3038 | Uint32 *src = (Uint32 *)info->src; |
3039 | Uint32 *dst = (Uint32 *)info->dst; |
3040 | int n = info->dst_w; |
3041 | while (n--) { |
3042 | srcpixel = *src; |
3043 | srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24); |
3044 | dstpixel = *dst; |
3045 | dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24); |
3046 | if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
3047 | /* This goes away if we ever use premultiplied alpha */ |
3048 | if (srcA < 255) { |
3049 | srcR = (srcR * srcA) / 255; |
3050 | srcG = (srcG * srcA) / 255; |
3051 | srcB = (srcB * srcA) / 255; |
3052 | } |
3053 | } |
3054 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
3055 | case SDL_COPY_BLEND: |
3056 | dstR = srcR + ((255 - srcA) * dstR) / 255; |
3057 | dstG = srcG + ((255 - srcA) * dstG) / 255; |
3058 | dstB = srcB + ((255 - srcA) * dstB) / 255; |
3059 | dstA = srcA + ((255 - srcA) * dstA) / 255; |
3060 | break; |
3061 | case SDL_COPY_ADD: |
3062 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
3063 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
3064 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
3065 | break; |
3066 | case SDL_COPY_MOD: |
3067 | dstR = (srcR * dstR) / 255; |
3068 | dstG = (srcG * dstG) / 255; |
3069 | dstB = (srcB * dstB) / 255; |
3070 | break; |
3071 | case SDL_COPY_MUL: |
3072 | dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255; |
3073 | dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255; |
3074 | dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255; |
3075 | dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) dstA = 255; |
3076 | break; |
3077 | } |
3078 | dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB; |
3079 | *dst = dstpixel; |
3080 | ++src; |
3081 | ++dst; |
3082 | } |
3083 | info->src += info->src_pitch; |
3084 | info->dst += info->dst_pitch; |
3085 | } |
3086 | } |
3087 | |
3088 | static void SDL_Blit_ARGB8888_ARGB8888_Blend_Scale(SDL_BlitInfo *info) |
3089 | { |
3090 | const int flags = info->flags; |
3091 | Uint32 srcpixel; |
3092 | Uint32 srcR, srcG, srcB, srcA; |
3093 | Uint32 dstpixel; |
3094 | Uint32 dstR, dstG, dstB, dstA; |
3095 | int srcy, srcx; |
3096 | Uint32 posy, posx; |
3097 | int incy, incx; |
3098 | |
3099 | incy = (info->src_h << 16) / info->dst_h; |
3100 | incx = (info->src_w << 16) / info->dst_w; |
3101 | posy = incy / 2; |
3102 | |
3103 | while (info->dst_h--) { |
3104 | Uint32 *src = 0; |
3105 | Uint32 *dst = (Uint32 *)info->dst; |
3106 | int n = info->dst_w; |
3107 | posx = incx / 2; |
3108 | |
3109 | srcy = posy >> 16; |
3110 | while (n--) { |
3111 | srcx = posx >> 16; |
3112 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
3113 | srcpixel = *src; |
3114 | srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24); |
3115 | dstpixel = *dst; |
3116 | dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24); |
3117 | if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
3118 | /* This goes away if we ever use premultiplied alpha */ |
3119 | if (srcA < 255) { |
3120 | srcR = (srcR * srcA) / 255; |
3121 | srcG = (srcG * srcA) / 255; |
3122 | srcB = (srcB * srcA) / 255; |
3123 | } |
3124 | } |
3125 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
3126 | case SDL_COPY_BLEND: |
3127 | dstR = srcR + ((255 - srcA) * dstR) / 255; |
3128 | dstG = srcG + ((255 - srcA) * dstG) / 255; |
3129 | dstB = srcB + ((255 - srcA) * dstB) / 255; |
3130 | dstA = srcA + ((255 - srcA) * dstA) / 255; |
3131 | break; |
3132 | case SDL_COPY_ADD: |
3133 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
3134 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
3135 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
3136 | break; |
3137 | case SDL_COPY_MOD: |
3138 | dstR = (srcR * dstR) / 255; |
3139 | dstG = (srcG * dstG) / 255; |
3140 | dstB = (srcB * dstB) / 255; |
3141 | break; |
3142 | case SDL_COPY_MUL: |
3143 | dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255; |
3144 | dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255; |
3145 | dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255; |
3146 | dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) dstA = 255; |
3147 | break; |
3148 | } |
3149 | dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB; |
3150 | *dst = dstpixel; |
3151 | posx += incx; |
3152 | ++dst; |
3153 | } |
3154 | posy += incy; |
3155 | info->dst += info->dst_pitch; |
3156 | } |
3157 | } |
3158 | |
3159 | static void SDL_Blit_ARGB8888_ARGB8888_Modulate(SDL_BlitInfo *info) |
3160 | { |
3161 | const int flags = info->flags; |
3162 | const Uint32 modulateR = info->r; |
3163 | const Uint32 modulateG = info->g; |
3164 | const Uint32 modulateB = info->b; |
3165 | const Uint32 modulateA = info->a; |
3166 | Uint32 pixel; |
3167 | Uint32 R, G, B, A; |
3168 | |
3169 | while (info->dst_h--) { |
3170 | Uint32 *src = (Uint32 *)info->src; |
3171 | Uint32 *dst = (Uint32 *)info->dst; |
3172 | int n = info->dst_w; |
3173 | while (n--) { |
3174 | pixel = *src; |
3175 | R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; A = (Uint8)(pixel >> 24); |
3176 | if (flags & SDL_COPY_MODULATE_COLOR) { |
3177 | R = (R * modulateR) / 255; |
3178 | G = (G * modulateG) / 255; |
3179 | B = (B * modulateB) / 255; |
3180 | } |
3181 | if (flags & SDL_COPY_MODULATE_ALPHA) { |
3182 | A = (A * modulateA) / 255; |
3183 | } |
3184 | pixel = (A << 24) | (R << 16) | (G << 8) | B; |
3185 | *dst = pixel; |
3186 | ++src; |
3187 | ++dst; |
3188 | } |
3189 | info->src += info->src_pitch; |
3190 | info->dst += info->dst_pitch; |
3191 | } |
3192 | } |
3193 | |
3194 | static void SDL_Blit_ARGB8888_ARGB8888_Modulate_Scale(SDL_BlitInfo *info) |
3195 | { |
3196 | const int flags = info->flags; |
3197 | const Uint32 modulateR = info->r; |
3198 | const Uint32 modulateG = info->g; |
3199 | const Uint32 modulateB = info->b; |
3200 | const Uint32 modulateA = info->a; |
3201 | Uint32 pixel; |
3202 | Uint32 R, G, B, A; |
3203 | int srcy, srcx; |
3204 | Uint32 posy, posx; |
3205 | int incy, incx; |
3206 | |
3207 | incy = (info->src_h << 16) / info->dst_h; |
3208 | incx = (info->src_w << 16) / info->dst_w; |
3209 | posy = incy / 2; |
3210 | |
3211 | while (info->dst_h--) { |
3212 | Uint32 *src = 0; |
3213 | Uint32 *dst = (Uint32 *)info->dst; |
3214 | int n = info->dst_w; |
3215 | posx = incx / 2; |
3216 | |
3217 | srcy = posy >> 16; |
3218 | while (n--) { |
3219 | srcx = posx >> 16; |
3220 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
3221 | pixel = *src; |
3222 | R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; A = (Uint8)(pixel >> 24); |
3223 | if (flags & SDL_COPY_MODULATE_COLOR) { |
3224 | R = (R * modulateR) / 255; |
3225 | G = (G * modulateG) / 255; |
3226 | B = (B * modulateB) / 255; |
3227 | } |
3228 | if (flags & SDL_COPY_MODULATE_ALPHA) { |
3229 | A = (A * modulateA) / 255; |
3230 | } |
3231 | pixel = (A << 24) | (R << 16) | (G << 8) | B; |
3232 | *dst = pixel; |
3233 | posx += incx; |
3234 | ++dst; |
3235 | } |
3236 | posy += incy; |
3237 | info->dst += info->dst_pitch; |
3238 | } |
3239 | } |
3240 | |
3241 | static void SDL_Blit_ARGB8888_ARGB8888_Modulate_Blend(SDL_BlitInfo *info) |
3242 | { |
3243 | const int flags = info->flags; |
3244 | const Uint32 modulateR = info->r; |
3245 | const Uint32 modulateG = info->g; |
3246 | const Uint32 modulateB = info->b; |
3247 | const Uint32 modulateA = info->a; |
3248 | Uint32 srcpixel; |
3249 | Uint32 srcR, srcG, srcB, srcA; |
3250 | Uint32 dstpixel; |
3251 | Uint32 dstR, dstG, dstB, dstA; |
3252 | |
3253 | while (info->dst_h--) { |
3254 | Uint32 *src = (Uint32 *)info->src; |
3255 | Uint32 *dst = (Uint32 *)info->dst; |
3256 | int n = info->dst_w; |
3257 | while (n--) { |
3258 | srcpixel = *src; |
3259 | srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24); |
3260 | dstpixel = *dst; |
3261 | dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24); |
3262 | if (flags & SDL_COPY_MODULATE_COLOR) { |
3263 | srcR = (srcR * modulateR) / 255; |
3264 | srcG = (srcG * modulateG) / 255; |
3265 | srcB = (srcB * modulateB) / 255; |
3266 | } |
3267 | if (flags & SDL_COPY_MODULATE_ALPHA) { |
3268 | srcA = (srcA * modulateA) / 255; |
3269 | } |
3270 | if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
3271 | /* This goes away if we ever use premultiplied alpha */ |
3272 | if (srcA < 255) { |
3273 | srcR = (srcR * srcA) / 255; |
3274 | srcG = (srcG * srcA) / 255; |
3275 | srcB = (srcB * srcA) / 255; |
3276 | } |
3277 | } |
3278 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
3279 | case SDL_COPY_BLEND: |
3280 | dstR = srcR + ((255 - srcA) * dstR) / 255; |
3281 | dstG = srcG + ((255 - srcA) * dstG) / 255; |
3282 | dstB = srcB + ((255 - srcA) * dstB) / 255; |
3283 | dstA = srcA + ((255 - srcA) * dstA) / 255; |
3284 | break; |
3285 | case SDL_COPY_ADD: |
3286 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
3287 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
3288 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
3289 | break; |
3290 | case SDL_COPY_MOD: |
3291 | dstR = (srcR * dstR) / 255; |
3292 | dstG = (srcG * dstG) / 255; |
3293 | dstB = (srcB * dstB) / 255; |
3294 | break; |
3295 | case SDL_COPY_MUL: |
3296 | dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255; |
3297 | dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255; |
3298 | dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255; |
3299 | dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) dstA = 255; |
3300 | break; |
3301 | } |
3302 | dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB; |
3303 | *dst = dstpixel; |
3304 | ++src; |
3305 | ++dst; |
3306 | } |
3307 | info->src += info->src_pitch; |
3308 | info->dst += info->dst_pitch; |
3309 | } |
3310 | } |
3311 | |
3312 | static void SDL_Blit_ARGB8888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info) |
3313 | { |
3314 | const int flags = info->flags; |
3315 | const Uint32 modulateR = info->r; |
3316 | const Uint32 modulateG = info->g; |
3317 | const Uint32 modulateB = info->b; |
3318 | const Uint32 modulateA = info->a; |
3319 | Uint32 srcpixel; |
3320 | Uint32 srcR, srcG, srcB, srcA; |
3321 | Uint32 dstpixel; |
3322 | Uint32 dstR, dstG, dstB, dstA; |
3323 | int srcy, srcx; |
3324 | Uint32 posy, posx; |
3325 | int incy, incx; |
3326 | |
3327 | incy = (info->src_h << 16) / info->dst_h; |
3328 | incx = (info->src_w << 16) / info->dst_w; |
3329 | posy = incy / 2; |
3330 | |
3331 | while (info->dst_h--) { |
3332 | Uint32 *src = 0; |
3333 | Uint32 *dst = (Uint32 *)info->dst; |
3334 | int n = info->dst_w; |
3335 | posx = incx / 2; |
3336 | |
3337 | srcy = posy >> 16; |
3338 | while (n--) { |
3339 | srcx = posx >> 16; |
3340 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
3341 | srcpixel = *src; |
3342 | srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24); |
3343 | dstpixel = *dst; |
3344 | dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24); |
3345 | if (flags & SDL_COPY_MODULATE_COLOR) { |
3346 | srcR = (srcR * modulateR) / 255; |
3347 | srcG = (srcG * modulateG) / 255; |
3348 | srcB = (srcB * modulateB) / 255; |
3349 | } |
3350 | if (flags & SDL_COPY_MODULATE_ALPHA) { |
3351 | srcA = (srcA * modulateA) / 255; |
3352 | } |
3353 | if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
3354 | /* This goes away if we ever use premultiplied alpha */ |
3355 | if (srcA < 255) { |
3356 | srcR = (srcR * srcA) / 255; |
3357 | srcG = (srcG * srcA) / 255; |
3358 | srcB = (srcB * srcA) / 255; |
3359 | } |
3360 | } |
3361 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
3362 | case SDL_COPY_BLEND: |
3363 | dstR = srcR + ((255 - srcA) * dstR) / 255; |
3364 | dstG = srcG + ((255 - srcA) * dstG) / 255; |
3365 | dstB = srcB + ((255 - srcA) * dstB) / 255; |
3366 | dstA = srcA + ((255 - srcA) * dstA) / 255; |
3367 | break; |
3368 | case SDL_COPY_ADD: |
3369 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
3370 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
3371 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
3372 | break; |
3373 | case SDL_COPY_MOD: |
3374 | dstR = (srcR * dstR) / 255; |
3375 | dstG = (srcG * dstG) / 255; |
3376 | dstB = (srcB * dstB) / 255; |
3377 | break; |
3378 | case SDL_COPY_MUL: |
3379 | dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255; |
3380 | dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255; |
3381 | dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255; |
3382 | dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) dstA = 255; |
3383 | break; |
3384 | } |
3385 | dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB; |
3386 | *dst = dstpixel; |
3387 | posx += incx; |
3388 | ++dst; |
3389 | } |
3390 | posy += incy; |
3391 | info->dst += info->dst_pitch; |
3392 | } |
3393 | } |
3394 | |
3395 | static void SDL_Blit_RGBA8888_RGB888_Scale(SDL_BlitInfo *info) |
3396 | { |
3397 | Uint32 pixel; |
3398 | Uint32 R, G, B; |
3399 | int srcy, srcx; |
3400 | Uint32 posy, posx; |
3401 | int incy, incx; |
3402 | |
3403 | incy = (info->src_h << 16) / info->dst_h; |
3404 | incx = (info->src_w << 16) / info->dst_w; |
3405 | posy = incy / 2; |
3406 | |
3407 | while (info->dst_h--) { |
3408 | Uint32 *src = 0; |
3409 | Uint32 *dst = (Uint32 *)info->dst; |
3410 | int n = info->dst_w; |
3411 | posx = incx / 2; |
3412 | |
3413 | srcy = posy >> 16; |
3414 | while (n--) { |
3415 | srcx = posx >> 16; |
3416 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
3417 | pixel = *src; |
3418 | R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); |
3419 | pixel = (R << 16) | (G << 8) | B; |
3420 | *dst = pixel; |
3421 | posx += incx; |
3422 | ++dst; |
3423 | } |
3424 | posy += incy; |
3425 | info->dst += info->dst_pitch; |
3426 | } |
3427 | } |
3428 | |
3429 | static void SDL_Blit_RGBA8888_RGB888_Blend(SDL_BlitInfo *info) |
3430 | { |
3431 | const int flags = info->flags; |
3432 | Uint32 srcpixel; |
3433 | Uint32 srcR, srcG, srcB, srcA; |
3434 | Uint32 dstpixel; |
3435 | Uint32 dstR, dstG, dstB; |
3436 | |
3437 | while (info->dst_h--) { |
3438 | Uint32 *src = (Uint32 *)info->src; |
3439 | Uint32 *dst = (Uint32 *)info->dst; |
3440 | int n = info->dst_w; |
3441 | while (n--) { |
3442 | srcpixel = *src; |
3443 | srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; |
3444 | dstpixel = *dst; |
3445 | dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; |
3446 | if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
3447 | /* This goes away if we ever use premultiplied alpha */ |
3448 | if (srcA < 255) { |
3449 | srcR = (srcR * srcA) / 255; |
3450 | srcG = (srcG * srcA) / 255; |
3451 | srcB = (srcB * srcA) / 255; |
3452 | } |
3453 | } |
3454 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
3455 | case SDL_COPY_BLEND: |
3456 | dstR = srcR + ((255 - srcA) * dstR) / 255; |
3457 | dstG = srcG + ((255 - srcA) * dstG) / 255; |
3458 | dstB = srcB + ((255 - srcA) * dstB) / 255; |
3459 | break; |
3460 | case SDL_COPY_ADD: |
3461 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
3462 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
3463 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
3464 | break; |
3465 | case SDL_COPY_MOD: |
3466 | dstR = (srcR * dstR) / 255; |
3467 | dstG = (srcG * dstG) / 255; |
3468 | dstB = (srcB * dstB) / 255; |
3469 | break; |
3470 | case SDL_COPY_MUL: |
3471 | dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255; |
3472 | dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255; |
3473 | dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255; |
3474 | break; |
3475 | } |
3476 | dstpixel = (dstR << 16) | (dstG << 8) | dstB; |
3477 | *dst = dstpixel; |
3478 | ++src; |
3479 | ++dst; |
3480 | } |
3481 | info->src += info->src_pitch; |
3482 | info->dst += info->dst_pitch; |
3483 | } |
3484 | } |
3485 | |
3486 | static void SDL_Blit_RGBA8888_RGB888_Blend_Scale(SDL_BlitInfo *info) |
3487 | { |
3488 | const int flags = info->flags; |
3489 | Uint32 srcpixel; |
3490 | Uint32 srcR, srcG, srcB, srcA; |
3491 | Uint32 dstpixel; |
3492 | Uint32 dstR, dstG, dstB; |
3493 | int srcy, srcx; |
3494 | Uint32 posy, posx; |
3495 | int incy, incx; |
3496 | |
3497 | incy = (info->src_h << 16) / info->dst_h; |
3498 | incx = (info->src_w << 16) / info->dst_w; |
3499 | posy = incy / 2; |
3500 | |
3501 | while (info->dst_h--) { |
3502 | Uint32 *src = 0; |
3503 | Uint32 *dst = (Uint32 *)info->dst; |
3504 | int n = info->dst_w; |
3505 | posx = incx / 2; |
3506 | |
3507 | srcy = posy >> 16; |
3508 | while (n--) { |
3509 | srcx = posx >> 16; |
3510 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
3511 | srcpixel = *src; |
3512 | srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; |
3513 | dstpixel = *dst; |
3514 | dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; |
3515 | if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
3516 | /* This goes away if we ever use premultiplied alpha */ |
3517 | if (srcA < 255) { |
3518 | srcR = (srcR * srcA) / 255; |
3519 | srcG = (srcG * srcA) / 255; |
3520 | srcB = (srcB * srcA) / 255; |
3521 | } |
3522 | } |
3523 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
3524 | case SDL_COPY_BLEND: |
3525 | dstR = srcR + ((255 - srcA) * dstR) / 255; |
3526 | dstG = srcG + ((255 - srcA) * dstG) / 255; |
3527 | dstB = srcB + ((255 - srcA) * dstB) / 255; |
3528 | break; |
3529 | case SDL_COPY_ADD: |
3530 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
3531 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
3532 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
3533 | break; |
3534 | case SDL_COPY_MOD: |
3535 | dstR = (srcR * dstR) / 255; |
3536 | dstG = (srcG * dstG) / 255; |
3537 | dstB = (srcB * dstB) / 255; |
3538 | break; |
3539 | case SDL_COPY_MUL: |
3540 | dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255; |
3541 | dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255; |
3542 | dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255; |
3543 | break; |
3544 | } |
3545 | dstpixel = (dstR << 16) | (dstG << 8) | dstB; |
3546 | *dst = dstpixel; |
3547 | posx += incx; |
3548 | ++dst; |
3549 | } |
3550 | posy += incy; |
3551 | info->dst += info->dst_pitch; |
3552 | } |
3553 | } |
3554 | |
3555 | static void SDL_Blit_RGBA8888_RGB888_Modulate(SDL_BlitInfo *info) |
3556 | { |
3557 | const int flags = info->flags; |
3558 | const Uint32 modulateR = info->r; |
3559 | const Uint32 modulateG = info->g; |
3560 | const Uint32 modulateB = info->b; |
3561 | Uint32 pixel; |
3562 | Uint32 R, G, B; |
3563 | |
3564 | while (info->dst_h--) { |
3565 | Uint32 *src = (Uint32 *)info->src; |
3566 | Uint32 *dst = (Uint32 *)info->dst; |
3567 | int n = info->dst_w; |
3568 | while (n--) { |
3569 | pixel = *src; |
3570 | R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); |
3571 | if (flags & SDL_COPY_MODULATE_COLOR) { |
3572 | R = (R * modulateR) / 255; |
3573 | G = (G * modulateG) / 255; |
3574 | B = (B * modulateB) / 255; |
3575 | } |
3576 | pixel = (R << 16) | (G << 8) | B; |
3577 | *dst = pixel; |
3578 | ++src; |
3579 | ++dst; |
3580 | } |
3581 | info->src += info->src_pitch; |
3582 | info->dst += info->dst_pitch; |
3583 | } |
3584 | } |
3585 | |
3586 | static void SDL_Blit_RGBA8888_RGB888_Modulate_Scale(SDL_BlitInfo *info) |
3587 | { |
3588 | const int flags = info->flags; |
3589 | const Uint32 modulateR = info->r; |
3590 | const Uint32 modulateG = info->g; |
3591 | const Uint32 modulateB = info->b; |
3592 | Uint32 pixel; |
3593 | Uint32 R, G, B; |
3594 | int srcy, srcx; |
3595 | Uint32 posy, posx; |
3596 | int incy, incx; |
3597 | |
3598 | incy = (info->src_h << 16) / info->dst_h; |
3599 | incx = (info->src_w << 16) / info->dst_w; |
3600 | posy = incy / 2; |
3601 | |
3602 | while (info->dst_h--) { |
3603 | Uint32 *src = 0; |
3604 | Uint32 *dst = (Uint32 *)info->dst; |
3605 | int n = info->dst_w; |
3606 | posx = incx / 2; |
3607 | |
3608 | srcy = posy >> 16; |
3609 | while (n--) { |
3610 | srcx = posx >> 16; |
3611 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
3612 | pixel = *src; |
3613 | R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); |
3614 | if (flags & SDL_COPY_MODULATE_COLOR) { |
3615 | R = (R * modulateR) / 255; |
3616 | G = (G * modulateG) / 255; |
3617 | B = (B * modulateB) / 255; |
3618 | } |
3619 | pixel = (R << 16) | (G << 8) | B; |
3620 | *dst = pixel; |
3621 | posx += incx; |
3622 | ++dst; |
3623 | } |
3624 | posy += incy; |
3625 | info->dst += info->dst_pitch; |
3626 | } |
3627 | } |
3628 | |
3629 | static void SDL_Blit_RGBA8888_RGB888_Modulate_Blend(SDL_BlitInfo *info) |
3630 | { |
3631 | const int flags = info->flags; |
3632 | const Uint32 modulateR = info->r; |
3633 | const Uint32 modulateG = info->g; |
3634 | const Uint32 modulateB = info->b; |
3635 | const Uint32 modulateA = info->a; |
3636 | Uint32 srcpixel; |
3637 | Uint32 srcR, srcG, srcB, srcA; |
3638 | Uint32 dstpixel; |
3639 | Uint32 dstR, dstG, dstB; |
3640 | |
3641 | while (info->dst_h--) { |
3642 | Uint32 *src = (Uint32 *)info->src; |
3643 | Uint32 *dst = (Uint32 *)info->dst; |
3644 | int n = info->dst_w; |
3645 | while (n--) { |
3646 | srcpixel = *src; |
3647 | srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; |
3648 | dstpixel = *dst; |
3649 | dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; |
3650 | if (flags & SDL_COPY_MODULATE_COLOR) { |
3651 | srcR = (srcR * modulateR) / 255; |
3652 | srcG = (srcG * modulateG) / 255; |
3653 | srcB = (srcB * modulateB) / 255; |
3654 | } |
3655 | if (flags & SDL_COPY_MODULATE_ALPHA) { |
3656 | srcA = (srcA * modulateA) / 255; |
3657 | } |
3658 | if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
3659 | /* This goes away if we ever use premultiplied alpha */ |
3660 | if (srcA < 255) { |
3661 | srcR = (srcR * srcA) / 255; |
3662 | srcG = (srcG * srcA) / 255; |
3663 | srcB = (srcB * srcA) / 255; |
3664 | } |
3665 | } |
3666 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
3667 | case SDL_COPY_BLEND: |
3668 | dstR = srcR + ((255 - srcA) * dstR) / 255; |
3669 | dstG = srcG + ((255 - srcA) * dstG) / 255; |
3670 | dstB = srcB + ((255 - srcA) * dstB) / 255; |
3671 | break; |
3672 | case SDL_COPY_ADD: |
3673 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
3674 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
3675 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
3676 | break; |
3677 | case SDL_COPY_MOD: |
3678 | dstR = (srcR * dstR) / 255; |
3679 | dstG = (srcG * dstG) / 255; |
3680 | dstB = (srcB * dstB) / 255; |
3681 | break; |
3682 | case SDL_COPY_MUL: |
3683 | dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255; |
3684 | dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255; |
3685 | dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255; |
3686 | break; |
3687 | } |
3688 | dstpixel = (dstR << 16) | (dstG << 8) | dstB; |
3689 | *dst = dstpixel; |
3690 | ++src; |
3691 | ++dst; |
3692 | } |
3693 | info->src += info->src_pitch; |
3694 | info->dst += info->dst_pitch; |
3695 | } |
3696 | } |
3697 | |
3698 | static void SDL_Blit_RGBA8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info) |
3699 | { |
3700 | const int flags = info->flags; |
3701 | const Uint32 modulateR = info->r; |
3702 | const Uint32 modulateG = info->g; |
3703 | const Uint32 modulateB = info->b; |
3704 | const Uint32 modulateA = info->a; |
3705 | Uint32 srcpixel; |
3706 | Uint32 srcR, srcG, srcB, srcA; |
3707 | Uint32 dstpixel; |
3708 | Uint32 dstR, dstG, dstB; |
3709 | int srcy, srcx; |
3710 | Uint32 posy, posx; |
3711 | int incy, incx; |
3712 | |
3713 | incy = (info->src_h << 16) / info->dst_h; |
3714 | incx = (info->src_w << 16) / info->dst_w; |
3715 | posy = incy / 2; |
3716 | |
3717 | while (info->dst_h--) { |
3718 | Uint32 *src = 0; |
3719 | Uint32 *dst = (Uint32 *)info->dst; |
3720 | int n = info->dst_w; |
3721 | posx = incx / 2; |
3722 | |
3723 | srcy = posy >> 16; |
3724 | while (n--) { |
3725 | srcx = posx >> 16; |
3726 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
3727 | srcpixel = *src; |
3728 | srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; |
3729 | dstpixel = *dst; |
3730 | dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; |
3731 | if (flags & SDL_COPY_MODULATE_COLOR) { |
3732 | srcR = (srcR * modulateR) / 255; |
3733 | srcG = (srcG * modulateG) / 255; |
3734 | srcB = (srcB * modulateB) / 255; |
3735 | } |
3736 | if (flags & SDL_COPY_MODULATE_ALPHA) { |
3737 | srcA = (srcA * modulateA) / 255; |
3738 | } |
3739 | if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
3740 | /* This goes away if we ever use premultiplied alpha */ |
3741 | if (srcA < 255) { |
3742 | srcR = (srcR * srcA) / 255; |
3743 | srcG = (srcG * srcA) / 255; |
3744 | srcB = (srcB * srcA) / 255; |
3745 | } |
3746 | } |
3747 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
3748 | case SDL_COPY_BLEND: |
3749 | dstR = srcR + ((255 - srcA) * dstR) / 255; |
3750 | dstG = srcG + ((255 - srcA) * dstG) / 255; |
3751 | dstB = srcB + ((255 - srcA) * dstB) / 255; |
3752 | break; |
3753 | case SDL_COPY_ADD: |
3754 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
3755 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
3756 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
3757 | break; |
3758 | case SDL_COPY_MOD: |
3759 | dstR = (srcR * dstR) / 255; |
3760 | dstG = (srcG * dstG) / 255; |
3761 | dstB = (srcB * dstB) / 255; |
3762 | break; |
3763 | case SDL_COPY_MUL: |
3764 | dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255; |
3765 | dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255; |
3766 | dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255; |
3767 | break; |
3768 | } |
3769 | dstpixel = (dstR << 16) | (dstG << 8) | dstB; |
3770 | *dst = dstpixel; |
3771 | posx += incx; |
3772 | ++dst; |
3773 | } |
3774 | posy += incy; |
3775 | info->dst += info->dst_pitch; |
3776 | } |
3777 | } |
3778 | |
3779 | static void SDL_Blit_RGBA8888_BGR888_Scale(SDL_BlitInfo *info) |
3780 | { |
3781 | Uint32 pixel; |
3782 | Uint32 R, G, B; |
3783 | int srcy, srcx; |
3784 | Uint32 posy, posx; |
3785 | int incy, incx; |
3786 | |
3787 | incy = (info->src_h << 16) / info->dst_h; |
3788 | incx = (info->src_w << 16) / info->dst_w; |
3789 | posy = incy / 2; |
3790 | |
3791 | while (info->dst_h--) { |
3792 | Uint32 *src = 0; |
3793 | Uint32 *dst = (Uint32 *)info->dst; |
3794 | int n = info->dst_w; |
3795 | posx = incx / 2; |
3796 | |
3797 | srcy = posy >> 16; |
3798 | while (n--) { |
3799 | srcx = posx >> 16; |
3800 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
3801 | pixel = *src; |
3802 | R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); |
3803 | pixel = (B << 16) | (G << 8) | R; |
3804 | *dst = pixel; |
3805 | posx += incx; |
3806 | ++dst; |
3807 | } |
3808 | posy += incy; |
3809 | info->dst += info->dst_pitch; |
3810 | } |
3811 | } |
3812 | |
3813 | static void SDL_Blit_RGBA8888_BGR888_Blend(SDL_BlitInfo *info) |
3814 | { |
3815 | const int flags = info->flags; |
3816 | Uint32 srcpixel; |
3817 | Uint32 srcR, srcG, srcB, srcA; |
3818 | Uint32 dstpixel; |
3819 | Uint32 dstR, dstG, dstB; |
3820 | |
3821 | while (info->dst_h--) { |
3822 | Uint32 *src = (Uint32 *)info->src; |
3823 | Uint32 *dst = (Uint32 *)info->dst; |
3824 | int n = info->dst_w; |
3825 | while (n--) { |
3826 | srcpixel = *src; |
3827 | srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; |
3828 | dstpixel = *dst; |
3829 | dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; |
3830 | if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
3831 | /* This goes away if we ever use premultiplied alpha */ |
3832 | if (srcA < 255) { |
3833 | srcR = (srcR * srcA) / 255; |
3834 | srcG = (srcG * srcA) / 255; |
3835 | srcB = (srcB * srcA) / 255; |
3836 | } |
3837 | } |
3838 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
3839 | case SDL_COPY_BLEND: |
3840 | dstR = srcR + ((255 - srcA) * dstR) / 255; |
3841 | dstG = srcG + ((255 - srcA) * dstG) / 255; |
3842 | dstB = srcB + ((255 - srcA) * dstB) / 255; |
3843 | break; |
3844 | case SDL_COPY_ADD: |
3845 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
3846 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
3847 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
3848 | break; |
3849 | case SDL_COPY_MOD: |
3850 | dstR = (srcR * dstR) / 255; |
3851 | dstG = (srcG * dstG) / 255; |
3852 | dstB = (srcB * dstB) / 255; |
3853 | break; |
3854 | case SDL_COPY_MUL: |
3855 | dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255; |
3856 | dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255; |
3857 | dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255; |
3858 | break; |
3859 | } |
3860 | dstpixel = (dstB << 16) | (dstG << 8) | dstR; |
3861 | *dst = dstpixel; |
3862 | ++src; |
3863 | ++dst; |
3864 | } |
3865 | info->src += info->src_pitch; |
3866 | info->dst += info->dst_pitch; |
3867 | } |
3868 | } |
3869 | |
3870 | static void SDL_Blit_RGBA8888_BGR888_Blend_Scale(SDL_BlitInfo *info) |
3871 | { |
3872 | const int flags = info->flags; |
3873 | Uint32 srcpixel; |
3874 | Uint32 srcR, srcG, srcB, srcA; |
3875 | Uint32 dstpixel; |
3876 | Uint32 dstR, dstG, dstB; |
3877 | int srcy, srcx; |
3878 | Uint32 posy, posx; |
3879 | int incy, incx; |
3880 | |
3881 | incy = (info->src_h << 16) / info->dst_h; |
3882 | incx = (info->src_w << 16) / info->dst_w; |
3883 | posy = incy / 2; |
3884 | |
3885 | while (info->dst_h--) { |
3886 | Uint32 *src = 0; |
3887 | Uint32 *dst = (Uint32 *)info->dst; |
3888 | int n = info->dst_w; |
3889 | posx = incx / 2; |
3890 | |
3891 | srcy = posy >> 16; |
3892 | while (n--) { |
3893 | srcx = posx >> 16; |
3894 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
3895 | srcpixel = *src; |
3896 | srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; |
3897 | dstpixel = *dst; |
3898 | dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; |
3899 | if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
3900 | /* This goes away if we ever use premultiplied alpha */ |
3901 | if (srcA < 255) { |
3902 | srcR = (srcR * srcA) / 255; |
3903 | srcG = (srcG * srcA) / 255; |
3904 | srcB = (srcB * srcA) / 255; |
3905 | } |
3906 | } |
3907 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
3908 | case SDL_COPY_BLEND: |
3909 | dstR = srcR + ((255 - srcA) * dstR) / 255; |
3910 | dstG = srcG + ((255 - srcA) * dstG) / 255; |
3911 | dstB = srcB + ((255 - srcA) * dstB) / 255; |
3912 | break; |
3913 | case SDL_COPY_ADD: |
3914 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
3915 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
3916 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
3917 | break; |
3918 | case SDL_COPY_MOD: |
3919 | dstR = (srcR * dstR) / 255; |
3920 | dstG = (srcG * dstG) / 255; |
3921 | dstB = (srcB * dstB) / 255; |
3922 | break; |
3923 | case SDL_COPY_MUL: |
3924 | dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255; |
3925 | dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255; |
3926 | dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255; |
3927 | break; |
3928 | } |
3929 | dstpixel = (dstB << 16) | (dstG << 8) | dstR; |
3930 | *dst = dstpixel; |
3931 | posx += incx; |
3932 | ++dst; |
3933 | } |
3934 | posy += incy; |
3935 | info->dst += info->dst_pitch; |
3936 | } |
3937 | } |
3938 | |
3939 | static void SDL_Blit_RGBA8888_BGR888_Modulate(SDL_BlitInfo *info) |
3940 | { |
3941 | const int flags = info->flags; |
3942 | const Uint32 modulateR = info->r; |
3943 | const Uint32 modulateG = info->g; |
3944 | const Uint32 modulateB = info->b; |
3945 | Uint32 pixel; |
3946 | Uint32 R, G, B; |
3947 | |
3948 | while (info->dst_h--) { |
3949 | Uint32 *src = (Uint32 *)info->src; |
3950 | Uint32 *dst = (Uint32 *)info->dst; |
3951 | int n = info->dst_w; |
3952 | while (n--) { |
3953 | pixel = *src; |
3954 | R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); |
3955 | if (flags & SDL_COPY_MODULATE_COLOR) { |
3956 | R = (R * modulateR) / 255; |
3957 | G = (G * modulateG) / 255; |
3958 | B = (B * modulateB) / 255; |
3959 | } |
3960 | pixel = (B << 16) | (G << 8) | R; |
3961 | *dst = pixel; |
3962 | ++src; |
3963 | ++dst; |
3964 | } |
3965 | info->src += info->src_pitch; |
3966 | info->dst += info->dst_pitch; |
3967 | } |
3968 | } |
3969 | |
3970 | static void SDL_Blit_RGBA8888_BGR888_Modulate_Scale(SDL_BlitInfo *info) |
3971 | { |
3972 | const int flags = info->flags; |
3973 | const Uint32 modulateR = info->r; |
3974 | const Uint32 modulateG = info->g; |
3975 | const Uint32 modulateB = info->b; |
3976 | Uint32 pixel; |
3977 | Uint32 R, G, B; |
3978 | int srcy, srcx; |
3979 | Uint32 posy, posx; |
3980 | int incy, incx; |
3981 | |
3982 | incy = (info->src_h << 16) / info->dst_h; |
3983 | incx = (info->src_w << 16) / info->dst_w; |
3984 | posy = incy / 2; |
3985 | |
3986 | while (info->dst_h--) { |
3987 | Uint32 *src = 0; |
3988 | Uint32 *dst = (Uint32 *)info->dst; |
3989 | int n = info->dst_w; |
3990 | posx = incx / 2; |
3991 | |
3992 | srcy = posy >> 16; |
3993 | while (n--) { |
3994 | srcx = posx >> 16; |
3995 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
3996 | pixel = *src; |
3997 | R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); |
3998 | if (flags & SDL_COPY_MODULATE_COLOR) { |
3999 | R = (R * modulateR) / 255; |
4000 | G = (G * modulateG) / 255; |
4001 | B = (B * modulateB) / 255; |
4002 | } |
4003 | pixel = (B << 16) | (G << 8) | R; |
4004 | *dst = pixel; |
4005 | posx += incx; |
4006 | ++dst; |
4007 | } |
4008 | posy += incy; |
4009 | info->dst += info->dst_pitch; |
4010 | } |
4011 | } |
4012 | |
4013 | static void SDL_Blit_RGBA8888_BGR888_Modulate_Blend(SDL_BlitInfo *info) |
4014 | { |
4015 | const int flags = info->flags; |
4016 | const Uint32 modulateR = info->r; |
4017 | const Uint32 modulateG = info->g; |
4018 | const Uint32 modulateB = info->b; |
4019 | const Uint32 modulateA = info->a; |
4020 | Uint32 srcpixel; |
4021 | Uint32 srcR, srcG, srcB, srcA; |
4022 | Uint32 dstpixel; |
4023 | Uint32 dstR, dstG, dstB; |
4024 | |
4025 | while (info->dst_h--) { |
4026 | Uint32 *src = (Uint32 *)info->src; |
4027 | Uint32 *dst = (Uint32 *)info->dst; |
4028 | int n = info->dst_w; |
4029 | while (n--) { |
4030 | srcpixel = *src; |
4031 | srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; |
4032 | dstpixel = *dst; |
4033 | dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; |
4034 | if (flags & SDL_COPY_MODULATE_COLOR) { |
4035 | srcR = (srcR * modulateR) / 255; |
4036 | srcG = (srcG * modulateG) / 255; |
4037 | srcB = (srcB * modulateB) / 255; |
4038 | } |
4039 | if (flags & SDL_COPY_MODULATE_ALPHA) { |
4040 | srcA = (srcA * modulateA) / 255; |
4041 | } |
4042 | if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
4043 | /* This goes away if we ever use premultiplied alpha */ |
4044 | if (srcA < 255) { |
4045 | srcR = (srcR * srcA) / 255; |
4046 | srcG = (srcG * srcA) / 255; |
4047 | srcB = (srcB * srcA) / 255; |
4048 | } |
4049 | } |
4050 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
4051 | case SDL_COPY_BLEND: |
4052 | dstR = srcR + ((255 - srcA) * dstR) / 255; |
4053 | dstG = srcG + ((255 - srcA) * dstG) / 255; |
4054 | dstB = srcB + ((255 - srcA) * dstB) / 255; |
4055 | break; |
4056 | case SDL_COPY_ADD: |
4057 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
4058 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
4059 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
4060 | break; |
4061 | case SDL_COPY_MOD: |
4062 | dstR = (srcR * dstR) / 255; |
4063 | dstG = (srcG * dstG) / 255; |
4064 | dstB = (srcB * dstB) / 255; |
4065 | break; |
4066 | case SDL_COPY_MUL: |
4067 | dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255; |
4068 | dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255; |
4069 | dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255; |
4070 | break; |
4071 | } |
4072 | dstpixel = (dstB << 16) | (dstG << 8) | dstR; |
4073 | *dst = dstpixel; |
4074 | ++src; |
4075 | ++dst; |
4076 | } |
4077 | info->src += info->src_pitch; |
4078 | info->dst += info->dst_pitch; |
4079 | } |
4080 | } |
4081 | |
4082 | static void SDL_Blit_RGBA8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info) |
4083 | { |
4084 | const int flags = info->flags; |
4085 | const Uint32 modulateR = info->r; |
4086 | const Uint32 modulateG = info->g; |
4087 | const Uint32 modulateB = info->b; |
4088 | const Uint32 modulateA = info->a; |
4089 | Uint32 srcpixel; |
4090 | Uint32 srcR, srcG, srcB, srcA; |
4091 | Uint32 dstpixel; |
4092 | Uint32 dstR, dstG, dstB; |
4093 | int srcy, srcx; |
4094 | Uint32 posy, posx; |
4095 | int incy, incx; |
4096 | |
4097 | incy = (info->src_h << 16) / info->dst_h; |
4098 | incx = (info->src_w << 16) / info->dst_w; |
4099 | posy = incy / 2; |
4100 | |
4101 | while (info->dst_h--) { |
4102 | Uint32 *src = 0; |
4103 | Uint32 *dst = (Uint32 *)info->dst; |
4104 | int n = info->dst_w; |
4105 | posx = incx / 2; |
4106 | |
4107 | srcy = posy >> 16; |
4108 | while (n--) { |
4109 | srcx = posx >> 16; |
4110 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
4111 | srcpixel = *src; |
4112 | srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; |
4113 | dstpixel = *dst; |
4114 | dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; |
4115 | if (flags & SDL_COPY_MODULATE_COLOR) { |
4116 | srcR = (srcR * modulateR) / 255; |
4117 | srcG = (srcG * modulateG) / 255; |
4118 | srcB = (srcB * modulateB) / 255; |
4119 | } |
4120 | if (flags & SDL_COPY_MODULATE_ALPHA) { |
4121 | srcA = (srcA * modulateA) / 255; |
4122 | } |
4123 | if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
4124 | /* This goes away if we ever use premultiplied alpha */ |
4125 | if (srcA < 255) { |
4126 | srcR = (srcR * srcA) / 255; |
4127 | srcG = (srcG * srcA) / 255; |
4128 | srcB = (srcB * srcA) / 255; |
4129 | } |
4130 | } |
4131 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
4132 | case SDL_COPY_BLEND: |
4133 | dstR = srcR + ((255 - srcA) * dstR) / 255; |
4134 | dstG = srcG + ((255 - srcA) * dstG) / 255; |
4135 | dstB = srcB + ((255 - srcA) * dstB) / 255; |
4136 | break; |
4137 | case SDL_COPY_ADD: |
4138 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
4139 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
4140 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
4141 | break; |
4142 | case SDL_COPY_MOD: |
4143 | dstR = (srcR * dstR) / 255; |
4144 | dstG = (srcG * dstG) / 255; |
4145 | dstB = (srcB * dstB) / 255; |
4146 | break; |
4147 | case SDL_COPY_MUL: |
4148 | dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255; |
4149 | dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255; |
4150 | dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255; |
4151 | break; |
4152 | } |
4153 | dstpixel = (dstB << 16) | (dstG << 8) | dstR; |
4154 | *dst = dstpixel; |
4155 | posx += incx; |
4156 | ++dst; |
4157 | } |
4158 | posy += incy; |
4159 | info->dst += info->dst_pitch; |
4160 | } |
4161 | } |
4162 | |
4163 | static void SDL_Blit_RGBA8888_ARGB8888_Scale(SDL_BlitInfo *info) |
4164 | { |
4165 | Uint32 pixel; |
4166 | Uint32 R, G, B, A; |
4167 | int srcy, srcx; |
4168 | Uint32 posy, posx; |
4169 | int incy, incx; |
4170 | |
4171 | incy = (info->src_h << 16) / info->dst_h; |
4172 | incx = (info->src_w << 16) / info->dst_w; |
4173 | posy = incy / 2; |
4174 | |
4175 | while (info->dst_h--) { |
4176 | Uint32 *src = 0; |
4177 | Uint32 *dst = (Uint32 *)info->dst; |
4178 | int n = info->dst_w; |
4179 | posx = incx / 2; |
4180 | |
4181 | srcy = posy >> 16; |
4182 | while (n--) { |
4183 | srcx = posx >> 16; |
4184 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
4185 | pixel = *src; |
4186 | R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel; |
4187 | pixel = (A << 24) | (R << 16) | (G << 8) | B; |
4188 | *dst = pixel; |
4189 | posx += incx; |
4190 | ++dst; |
4191 | } |
4192 | posy += incy; |
4193 | info->dst += info->dst_pitch; |
4194 | } |
4195 | } |
4196 | |
4197 | static void SDL_Blit_RGBA8888_ARGB8888_Blend(SDL_BlitInfo *info) |
4198 | { |
4199 | const int flags = info->flags; |
4200 | Uint32 srcpixel; |
4201 | Uint32 srcR, srcG, srcB, srcA; |
4202 | Uint32 dstpixel; |
4203 | Uint32 dstR, dstG, dstB, dstA; |
4204 | |
4205 | while (info->dst_h--) { |
4206 | Uint32 *src = (Uint32 *)info->src; |
4207 | Uint32 *dst = (Uint32 *)info->dst; |
4208 | int n = info->dst_w; |
4209 | while (n--) { |
4210 | srcpixel = *src; |
4211 | srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; |
4212 | dstpixel = *dst; |
4213 | dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24); |
4214 | if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
4215 | /* This goes away if we ever use premultiplied alpha */ |
4216 | if (srcA < 255) { |
4217 | srcR = (srcR * srcA) / 255; |
4218 | srcG = (srcG * srcA) / 255; |
4219 | srcB = (srcB * srcA) / 255; |
4220 | } |
4221 | } |
4222 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
4223 | case SDL_COPY_BLEND: |
4224 | dstR = srcR + ((255 - srcA) * dstR) / 255; |
4225 | dstG = srcG + ((255 - srcA) * dstG) / 255; |
4226 | dstB = srcB + ((255 - srcA) * dstB) / 255; |
4227 | dstA = srcA + ((255 - srcA) * dstA) / 255; |
4228 | break; |
4229 | case SDL_COPY_ADD: |
4230 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
4231 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
4232 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
4233 | break; |
4234 | case SDL_COPY_MOD: |
4235 | dstR = (srcR * dstR) / 255; |
4236 | dstG = (srcG * dstG) / 255; |
4237 | dstB = (srcB * dstB) / 255; |
4238 | break; |
4239 | case SDL_COPY_MUL: |
4240 | dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255; |
4241 | dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255; |
4242 | dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255; |
4243 | dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) dstA = 255; |
4244 | break; |
4245 | } |
4246 | dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB; |
4247 | *dst = dstpixel; |
4248 | ++src; |
4249 | ++dst; |
4250 | } |
4251 | info->src += info->src_pitch; |
4252 | info->dst += info->dst_pitch; |
4253 | } |
4254 | } |
4255 | |
4256 | static void SDL_Blit_RGBA8888_ARGB8888_Blend_Scale(SDL_BlitInfo *info) |
4257 | { |
4258 | const int flags = info->flags; |
4259 | Uint32 srcpixel; |
4260 | Uint32 srcR, srcG, srcB, srcA; |
4261 | Uint32 dstpixel; |
4262 | Uint32 dstR, dstG, dstB, dstA; |
4263 | int srcy, srcx; |
4264 | Uint32 posy, posx; |
4265 | int incy, incx; |
4266 | |
4267 | incy = (info->src_h << 16) / info->dst_h; |
4268 | incx = (info->src_w << 16) / info->dst_w; |
4269 | posy = incy / 2; |
4270 | |
4271 | while (info->dst_h--) { |
4272 | Uint32 *src = 0; |
4273 | Uint32 *dst = (Uint32 *)info->dst; |
4274 | int n = info->dst_w; |
4275 | posx = incx / 2; |
4276 | |
4277 | srcy = posy >> 16; |
4278 | while (n--) { |
4279 | srcx = posx >> 16; |
4280 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
4281 | srcpixel = *src; |
4282 | srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; |
4283 | dstpixel = *dst; |
4284 | dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24); |
4285 | if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
4286 | /* This goes away if we ever use premultiplied alpha */ |
4287 | if (srcA < 255) { |
4288 | srcR = (srcR * srcA) / 255; |
4289 | srcG = (srcG * srcA) / 255; |
4290 | srcB = (srcB * srcA) / 255; |
4291 | } |
4292 | } |
4293 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
4294 | case SDL_COPY_BLEND: |
4295 | dstR = srcR + ((255 - srcA) * dstR) / 255; |
4296 | dstG = srcG + ((255 - srcA) * dstG) / 255; |
4297 | dstB = srcB + ((255 - srcA) * dstB) / 255; |
4298 | dstA = srcA + ((255 - srcA) * dstA) / 255; |
4299 | break; |
4300 | case SDL_COPY_ADD: |
4301 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
4302 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
4303 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
4304 | break; |
4305 | case SDL_COPY_MOD: |
4306 | dstR = (srcR * dstR) / 255; |
4307 | dstG = (srcG * dstG) / 255; |
4308 | dstB = (srcB * dstB) / 255; |
4309 | break; |
4310 | case SDL_COPY_MUL: |
4311 | dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255; |
4312 | dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255; |
4313 | dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255; |
4314 | dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) dstA = 255; |
4315 | break; |
4316 | } |
4317 | dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB; |
4318 | *dst = dstpixel; |
4319 | posx += incx; |
4320 | ++dst; |
4321 | } |
4322 | posy += incy; |
4323 | info->dst += info->dst_pitch; |
4324 | } |
4325 | } |
4326 | |
4327 | static void SDL_Blit_RGBA8888_ARGB8888_Modulate(SDL_BlitInfo *info) |
4328 | { |
4329 | const int flags = info->flags; |
4330 | const Uint32 modulateR = info->r; |
4331 | const Uint32 modulateG = info->g; |
4332 | const Uint32 modulateB = info->b; |
4333 | const Uint32 modulateA = info->a; |
4334 | Uint32 pixel; |
4335 | Uint32 R, G, B, A; |
4336 | |
4337 | while (info->dst_h--) { |
4338 | Uint32 *src = (Uint32 *)info->src; |
4339 | Uint32 *dst = (Uint32 *)info->dst; |
4340 | int n = info->dst_w; |
4341 | while (n--) { |
4342 | pixel = *src; |
4343 | R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel; |
4344 | if (flags & SDL_COPY_MODULATE_COLOR) { |
4345 | R = (R * modulateR) / 255; |
4346 | G = (G * modulateG) / 255; |
4347 | B = (B * modulateB) / 255; |
4348 | } |
4349 | if (flags & SDL_COPY_MODULATE_ALPHA) { |
4350 | A = (A * modulateA) / 255; |
4351 | } |
4352 | pixel = (A << 24) | (R << 16) | (G << 8) | B; |
4353 | *dst = pixel; |
4354 | ++src; |
4355 | ++dst; |
4356 | } |
4357 | info->src += info->src_pitch; |
4358 | info->dst += info->dst_pitch; |
4359 | } |
4360 | } |
4361 | |
4362 | static void SDL_Blit_RGBA8888_ARGB8888_Modulate_Scale(SDL_BlitInfo *info) |
4363 | { |
4364 | const int flags = info->flags; |
4365 | const Uint32 modulateR = info->r; |
4366 | const Uint32 modulateG = info->g; |
4367 | const Uint32 modulateB = info->b; |
4368 | const Uint32 modulateA = info->a; |
4369 | Uint32 pixel; |
4370 | Uint32 R, G, B, A; |
4371 | int srcy, srcx; |
4372 | Uint32 posy, posx; |
4373 | int incy, incx; |
4374 | |
4375 | incy = (info->src_h << 16) / info->dst_h; |
4376 | incx = (info->src_w << 16) / info->dst_w; |
4377 | posy = incy / 2; |
4378 | |
4379 | while (info->dst_h--) { |
4380 | Uint32 *src = 0; |
4381 | Uint32 *dst = (Uint32 *)info->dst; |
4382 | int n = info->dst_w; |
4383 | posx = incx / 2; |
4384 | |
4385 | srcy = posy >> 16; |
4386 | while (n--) { |
4387 | srcx = posx >> 16; |
4388 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
4389 | pixel = *src; |
4390 | R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel; |
4391 | if (flags & SDL_COPY_MODULATE_COLOR) { |
4392 | R = (R * modulateR) / 255; |
4393 | G = (G * modulateG) / 255; |
4394 | B = (B * modulateB) / 255; |
4395 | } |
4396 | if (flags & SDL_COPY_MODULATE_ALPHA) { |
4397 | A = (A * modulateA) / 255; |
4398 | } |
4399 | pixel = (A << 24) | (R << 16) | (G << 8) | B; |
4400 | *dst = pixel; |
4401 | posx += incx; |
4402 | ++dst; |
4403 | } |
4404 | posy += incy; |
4405 | info->dst += info->dst_pitch; |
4406 | } |
4407 | } |
4408 | |
4409 | static void SDL_Blit_RGBA8888_ARGB8888_Modulate_Blend(SDL_BlitInfo *info) |
4410 | { |
4411 | const int flags = info->flags; |
4412 | const Uint32 modulateR = info->r; |
4413 | const Uint32 modulateG = info->g; |
4414 | const Uint32 modulateB = info->b; |
4415 | const Uint32 modulateA = info->a; |
4416 | Uint32 srcpixel; |
4417 | Uint32 srcR, srcG, srcB, srcA; |
4418 | Uint32 dstpixel; |
4419 | Uint32 dstR, dstG, dstB, dstA; |
4420 | |
4421 | while (info->dst_h--) { |
4422 | Uint32 *src = (Uint32 *)info->src; |
4423 | Uint32 *dst = (Uint32 *)info->dst; |
4424 | int n = info->dst_w; |
4425 | while (n--) { |
4426 | srcpixel = *src; |
4427 | srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; |
4428 | dstpixel = *dst; |
4429 | dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24); |
4430 | if (flags & SDL_COPY_MODULATE_COLOR) { |
4431 | srcR = (srcR * modulateR) / 255; |
4432 | srcG = (srcG * modulateG) / 255; |
4433 | srcB = (srcB * modulateB) / 255; |
4434 | } |
4435 | if (flags & SDL_COPY_MODULATE_ALPHA) { |
4436 | srcA = (srcA * modulateA) / 255; |
4437 | } |
4438 | if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
4439 | /* This goes away if we ever use premultiplied alpha */ |
4440 | if (srcA < 255) { |
4441 | srcR = (srcR * srcA) / 255; |
4442 | srcG = (srcG * srcA) / 255; |
4443 | srcB = (srcB * srcA) / 255; |
4444 | } |
4445 | } |
4446 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
4447 | case SDL_COPY_BLEND: |
4448 | dstR = srcR + ((255 - srcA) * dstR) / 255; |
4449 | dstG = srcG + ((255 - srcA) * dstG) / 255; |
4450 | dstB = srcB + ((255 - srcA) * dstB) / 255; |
4451 | dstA = srcA + ((255 - srcA) * dstA) / 255; |
4452 | break; |
4453 | case SDL_COPY_ADD: |
4454 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
4455 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
4456 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
4457 | break; |
4458 | case SDL_COPY_MOD: |
4459 | dstR = (srcR * dstR) / 255; |
4460 | dstG = (srcG * dstG) / 255; |
4461 | dstB = (srcB * dstB) / 255; |
4462 | break; |
4463 | case SDL_COPY_MUL: |
4464 | dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255; |
4465 | dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255; |
4466 | dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255; |
4467 | dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) dstA = 255; |
4468 | break; |
4469 | } |
4470 | dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB; |
4471 | *dst = dstpixel; |
4472 | ++src; |
4473 | ++dst; |
4474 | } |
4475 | info->src += info->src_pitch; |
4476 | info->dst += info->dst_pitch; |
4477 | } |
4478 | } |
4479 | |
4480 | static void SDL_Blit_RGBA8888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info) |
4481 | { |
4482 | const int flags = info->flags; |
4483 | const Uint32 modulateR = info->r; |
4484 | const Uint32 modulateG = info->g; |
4485 | const Uint32 modulateB = info->b; |
4486 | const Uint32 modulateA = info->a; |
4487 | Uint32 srcpixel; |
4488 | Uint32 srcR, srcG, srcB, srcA; |
4489 | Uint32 dstpixel; |
4490 | Uint32 dstR, dstG, dstB, dstA; |
4491 | int srcy, srcx; |
4492 | Uint32 posy, posx; |
4493 | int incy, incx; |
4494 | |
4495 | incy = (info->src_h << 16) / info->dst_h; |
4496 | incx = (info->src_w << 16) / info->dst_w; |
4497 | posy = incy / 2; |
4498 | |
4499 | while (info->dst_h--) { |
4500 | Uint32 *src = 0; |
4501 | Uint32 *dst = (Uint32 *)info->dst; |
4502 | int n = info->dst_w; |
4503 | posx = incx / 2; |
4504 | |
4505 | srcy = posy >> 16; |
4506 | while (n--) { |
4507 | srcx = posx >> 16; |
4508 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
4509 | srcpixel = *src; |
4510 | srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; |
4511 | dstpixel = *dst; |
4512 | dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24); |
4513 | if (flags & SDL_COPY_MODULATE_COLOR) { |
4514 | srcR = (srcR * modulateR) / 255; |
4515 | srcG = (srcG * modulateG) / 255; |
4516 | srcB = (srcB * modulateB) / 255; |
4517 | } |
4518 | if (flags & SDL_COPY_MODULATE_ALPHA) { |
4519 | srcA = (srcA * modulateA) / 255; |
4520 | } |
4521 | if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
4522 | /* This goes away if we ever use premultiplied alpha */ |
4523 | if (srcA < 255) { |
4524 | srcR = (srcR * srcA) / 255; |
4525 | srcG = (srcG * srcA) / 255; |
4526 | srcB = (srcB * srcA) / 255; |
4527 | } |
4528 | } |
4529 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
4530 | case SDL_COPY_BLEND: |
4531 | dstR = srcR + ((255 - srcA) * dstR) / 255; |
4532 | dstG = srcG + ((255 - srcA) * dstG) / 255; |
4533 | dstB = srcB + ((255 - srcA) * dstB) / 255; |
4534 | dstA = srcA + ((255 - srcA) * dstA) / 255; |
4535 | break; |
4536 | case SDL_COPY_ADD: |
4537 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
4538 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
4539 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
4540 | break; |
4541 | case SDL_COPY_MOD: |
4542 | dstR = (srcR * dstR) / 255; |
4543 | dstG = (srcG * dstG) / 255; |
4544 | dstB = (srcB * dstB) / 255; |
4545 | break; |
4546 | case SDL_COPY_MUL: |
4547 | dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255; |
4548 | dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255; |
4549 | dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255; |
4550 | dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) dstA = 255; |
4551 | break; |
4552 | } |
4553 | dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB; |
4554 | *dst = dstpixel; |
4555 | posx += incx; |
4556 | ++dst; |
4557 | } |
4558 | posy += incy; |
4559 | info->dst += info->dst_pitch; |
4560 | } |
4561 | } |
4562 | |
4563 | static void SDL_Blit_ABGR8888_RGB888_Scale(SDL_BlitInfo *info) |
4564 | { |
4565 | Uint32 pixel; |
4566 | Uint32 R, G, B; |
4567 | int srcy, srcx; |
4568 | Uint32 posy, posx; |
4569 | int incy, incx; |
4570 | |
4571 | incy = (info->src_h << 16) / info->dst_h; |
4572 | incx = (info->src_w << 16) / info->dst_w; |
4573 | posy = incy / 2; |
4574 | |
4575 | while (info->dst_h--) { |
4576 | Uint32 *src = 0; |
4577 | Uint32 *dst = (Uint32 *)info->dst; |
4578 | int n = info->dst_w; |
4579 | posx = incx / 2; |
4580 | |
4581 | srcy = posy >> 16; |
4582 | while (n--) { |
4583 | srcx = posx >> 16; |
4584 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
4585 | pixel = *src; |
4586 | B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; |
4587 | pixel = (R << 16) | (G << 8) | B; |
4588 | *dst = pixel; |
4589 | posx += incx; |
4590 | ++dst; |
4591 | } |
4592 | posy += incy; |
4593 | info->dst += info->dst_pitch; |
4594 | } |
4595 | } |
4596 | |
4597 | static void SDL_Blit_ABGR8888_RGB888_Blend(SDL_BlitInfo *info) |
4598 | { |
4599 | const int flags = info->flags; |
4600 | Uint32 srcpixel; |
4601 | Uint32 srcR, srcG, srcB, srcA; |
4602 | Uint32 dstpixel; |
4603 | Uint32 dstR, dstG, dstB; |
4604 | |
4605 | while (info->dst_h--) { |
4606 | Uint32 *src = (Uint32 *)info->src; |
4607 | Uint32 *dst = (Uint32 *)info->dst; |
4608 | int n = info->dst_w; |
4609 | while (n--) { |
4610 | srcpixel = *src; |
4611 | srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24); |
4612 | dstpixel = *dst; |
4613 | dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; |
4614 | if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
4615 | /* This goes away if we ever use premultiplied alpha */ |
4616 | if (srcA < 255) { |
4617 | srcR = (srcR * srcA) / 255; |
4618 | srcG = (srcG * srcA) / 255; |
4619 | srcB = (srcB * srcA) / 255; |
4620 | } |
4621 | } |
4622 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
4623 | case SDL_COPY_BLEND: |
4624 | dstR = srcR + ((255 - srcA) * dstR) / 255; |
4625 | dstG = srcG + ((255 - srcA) * dstG) / 255; |
4626 | dstB = srcB + ((255 - srcA) * dstB) / 255; |
4627 | break; |
4628 | case SDL_COPY_ADD: |
4629 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
4630 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
4631 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
4632 | break; |
4633 | case SDL_COPY_MOD: |
4634 | dstR = (srcR * dstR) / 255; |
4635 | dstG = (srcG * dstG) / 255; |
4636 | dstB = (srcB * dstB) / 255; |
4637 | break; |
4638 | case SDL_COPY_MUL: |
4639 | dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255; |
4640 | dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255; |
4641 | dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255; |
4642 | break; |
4643 | } |
4644 | dstpixel = (dstR << 16) | (dstG << 8) | dstB; |
4645 | *dst = dstpixel; |
4646 | ++src; |
4647 | ++dst; |
4648 | } |
4649 | info->src += info->src_pitch; |
4650 | info->dst += info->dst_pitch; |
4651 | } |
4652 | } |
4653 | |
4654 | static void SDL_Blit_ABGR8888_RGB888_Blend_Scale(SDL_BlitInfo *info) |
4655 | { |
4656 | const int flags = info->flags; |
4657 | Uint32 srcpixel; |
4658 | Uint32 srcR, srcG, srcB, srcA; |
4659 | Uint32 dstpixel; |
4660 | Uint32 dstR, dstG, dstB; |
4661 | int srcy, srcx; |
4662 | Uint32 posy, posx; |
4663 | int incy, incx; |
4664 | |
4665 | incy = (info->src_h << 16) / info->dst_h; |
4666 | incx = (info->src_w << 16) / info->dst_w; |
4667 | posy = incy / 2; |
4668 | |
4669 | while (info->dst_h--) { |
4670 | Uint32 *src = 0; |
4671 | Uint32 *dst = (Uint32 *)info->dst; |
4672 | int n = info->dst_w; |
4673 | posx = incx / 2; |
4674 | |
4675 | srcy = posy >> 16; |
4676 | while (n--) { |
4677 | srcx = posx >> 16; |
4678 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
4679 | srcpixel = *src; |
4680 | srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24); |
4681 | dstpixel = *dst; |
4682 | dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; |
4683 | if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
4684 | /* This goes away if we ever use premultiplied alpha */ |
4685 | if (srcA < 255) { |
4686 | srcR = (srcR * srcA) / 255; |
4687 | srcG = (srcG * srcA) / 255; |
4688 | srcB = (srcB * srcA) / 255; |
4689 | } |
4690 | } |
4691 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
4692 | case SDL_COPY_BLEND: |
4693 | dstR = srcR + ((255 - srcA) * dstR) / 255; |
4694 | dstG = srcG + ((255 - srcA) * dstG) / 255; |
4695 | dstB = srcB + ((255 - srcA) * dstB) / 255; |
4696 | break; |
4697 | case SDL_COPY_ADD: |
4698 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
4699 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
4700 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
4701 | break; |
4702 | case SDL_COPY_MOD: |
4703 | dstR = (srcR * dstR) / 255; |
4704 | dstG = (srcG * dstG) / 255; |
4705 | dstB = (srcB * dstB) / 255; |
4706 | break; |
4707 | case SDL_COPY_MUL: |
4708 | dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255; |
4709 | dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255; |
4710 | dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255; |
4711 | break; |
4712 | } |
4713 | dstpixel = (dstR << 16) | (dstG << 8) | dstB; |
4714 | *dst = dstpixel; |
4715 | posx += incx; |
4716 | ++dst; |
4717 | } |
4718 | posy += incy; |
4719 | info->dst += info->dst_pitch; |
4720 | } |
4721 | } |
4722 | |
4723 | static void SDL_Blit_ABGR8888_RGB888_Modulate(SDL_BlitInfo *info) |
4724 | { |
4725 | const int flags = info->flags; |
4726 | const Uint32 modulateR = info->r; |
4727 | const Uint32 modulateG = info->g; |
4728 | const Uint32 modulateB = info->b; |
4729 | Uint32 pixel; |
4730 | Uint32 R, G, B; |
4731 | |
4732 | while (info->dst_h--) { |
4733 | Uint32 *src = (Uint32 *)info->src; |
4734 | Uint32 *dst = (Uint32 *)info->dst; |
4735 | int n = info->dst_w; |
4736 | while (n--) { |
4737 | pixel = *src; |
4738 | B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; |
4739 | if (flags & SDL_COPY_MODULATE_COLOR) { |
4740 | R = (R * modulateR) / 255; |
4741 | G = (G * modulateG) / 255; |
4742 | B = (B * modulateB) / 255; |
4743 | } |
4744 | pixel = (R << 16) | (G << 8) | B; |
4745 | *dst = pixel; |
4746 | ++src; |
4747 | ++dst; |
4748 | } |
4749 | info->src += info->src_pitch; |
4750 | info->dst += info->dst_pitch; |
4751 | } |
4752 | } |
4753 | |
4754 | static void SDL_Blit_ABGR8888_RGB888_Modulate_Scale(SDL_BlitInfo *info) |
4755 | { |
4756 | const int flags = info->flags; |
4757 | const Uint32 modulateR = info->r; |
4758 | const Uint32 modulateG = info->g; |
4759 | const Uint32 modulateB = info->b; |
4760 | Uint32 pixel; |
4761 | Uint32 R, G, B; |
4762 | int srcy, srcx; |
4763 | Uint32 posy, posx; |
4764 | int incy, incx; |
4765 | |
4766 | incy = (info->src_h << 16) / info->dst_h; |
4767 | incx = (info->src_w << 16) / info->dst_w; |
4768 | posy = incy / 2; |
4769 | |
4770 | while (info->dst_h--) { |
4771 | Uint32 *src = 0; |
4772 | Uint32 *dst = (Uint32 *)info->dst; |
4773 | int n = info->dst_w; |
4774 | posx = incx / 2; |
4775 | |
4776 | srcy = posy >> 16; |
4777 | while (n--) { |
4778 | srcx = posx >> 16; |
4779 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
4780 | pixel = *src; |
4781 | B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; |
4782 | if (flags & SDL_COPY_MODULATE_COLOR) { |
4783 | R = (R * modulateR) / 255; |
4784 | G = (G * modulateG) / 255; |
4785 | B = (B * modulateB) / 255; |
4786 | } |
4787 | pixel = (R << 16) | (G << 8) | B; |
4788 | *dst = pixel; |
4789 | posx += incx; |
4790 | ++dst; |
4791 | } |
4792 | posy += incy; |
4793 | info->dst += info->dst_pitch; |
4794 | } |
4795 | } |
4796 | |
4797 | static void SDL_Blit_ABGR8888_RGB888_Modulate_Blend(SDL_BlitInfo *info) |
4798 | { |
4799 | const int flags = info->flags; |
4800 | const Uint32 modulateR = info->r; |
4801 | const Uint32 modulateG = info->g; |
4802 | const Uint32 modulateB = info->b; |
4803 | const Uint32 modulateA = info->a; |
4804 | Uint32 srcpixel; |
4805 | Uint32 srcR, srcG, srcB, srcA; |
4806 | Uint32 dstpixel; |
4807 | Uint32 dstR, dstG, dstB; |
4808 | |
4809 | while (info->dst_h--) { |
4810 | Uint32 *src = (Uint32 *)info->src; |
4811 | Uint32 *dst = (Uint32 *)info->dst; |
4812 | int n = info->dst_w; |
4813 | while (n--) { |
4814 | srcpixel = *src; |
4815 | srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24); |
4816 | dstpixel = *dst; |
4817 | dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; |
4818 | if (flags & SDL_COPY_MODULATE_COLOR) { |
4819 | srcR = (srcR * modulateR) / 255; |
4820 | srcG = (srcG * modulateG) / 255; |
4821 | srcB = (srcB * modulateB) / 255; |
4822 | } |
4823 | if (flags & SDL_COPY_MODULATE_ALPHA) { |
4824 | srcA = (srcA * modulateA) / 255; |
4825 | } |
4826 | if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
4827 | /* This goes away if we ever use premultiplied alpha */ |
4828 | if (srcA < 255) { |
4829 | srcR = (srcR * srcA) / 255; |
4830 | srcG = (srcG * srcA) / 255; |
4831 | srcB = (srcB * srcA) / 255; |
4832 | } |
4833 | } |
4834 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
4835 | case SDL_COPY_BLEND: |
4836 | dstR = srcR + ((255 - srcA) * dstR) / 255; |
4837 | dstG = srcG + ((255 - srcA) * dstG) / 255; |
4838 | dstB = srcB + ((255 - srcA) * dstB) / 255; |
4839 | break; |
4840 | case SDL_COPY_ADD: |
4841 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
4842 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
4843 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
4844 | break; |
4845 | case SDL_COPY_MOD: |
4846 | dstR = (srcR * dstR) / 255; |
4847 | dstG = (srcG * dstG) / 255; |
4848 | dstB = (srcB * dstB) / 255; |
4849 | break; |
4850 | case SDL_COPY_MUL: |
4851 | dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255; |
4852 | dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255; |
4853 | dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255; |
4854 | break; |
4855 | } |
4856 | dstpixel = (dstR << 16) | (dstG << 8) | dstB; |
4857 | *dst = dstpixel; |
4858 | ++src; |
4859 | ++dst; |
4860 | } |
4861 | info->src += info->src_pitch; |
4862 | info->dst += info->dst_pitch; |
4863 | } |
4864 | } |
4865 | |
4866 | static void SDL_Blit_ABGR8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info) |
4867 | { |
4868 | const int flags = info->flags; |
4869 | const Uint32 modulateR = info->r; |
4870 | const Uint32 modulateG = info->g; |
4871 | const Uint32 modulateB = info->b; |
4872 | const Uint32 modulateA = info->a; |
4873 | Uint32 srcpixel; |
4874 | Uint32 srcR, srcG, srcB, srcA; |
4875 | Uint32 dstpixel; |
4876 | Uint32 dstR, dstG, dstB; |
4877 | int srcy, srcx; |
4878 | Uint32 posy, posx; |
4879 | int incy, incx; |
4880 | |
4881 | incy = (info->src_h << 16) / info->dst_h; |
4882 | incx = (info->src_w << 16) / info->dst_w; |
4883 | posy = incy / 2; |
4884 | |
4885 | while (info->dst_h--) { |
4886 | Uint32 *src = 0; |
4887 | Uint32 *dst = (Uint32 *)info->dst; |
4888 | int n = info->dst_w; |
4889 | posx = incx / 2; |
4890 | |
4891 | srcy = posy >> 16; |
4892 | while (n--) { |
4893 | srcx = posx >> 16; |
4894 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
4895 | srcpixel = *src; |
4896 | srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24); |
4897 | dstpixel = *dst; |
4898 | dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; |
4899 | if (flags & SDL_COPY_MODULATE_COLOR) { |
4900 | srcR = (srcR * modulateR) / 255; |
4901 | srcG = (srcG * modulateG) / 255; |
4902 | srcB = (srcB * modulateB) / 255; |
4903 | } |
4904 | if (flags & SDL_COPY_MODULATE_ALPHA) { |
4905 | srcA = (srcA * modulateA) / 255; |
4906 | } |
4907 | if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
4908 | /* This goes away if we ever use premultiplied alpha */ |
4909 | if (srcA < 255) { |
4910 | srcR = (srcR * srcA) / 255; |
4911 | srcG = (srcG * srcA) / 255; |
4912 | srcB = (srcB * srcA) / 255; |
4913 | } |
4914 | } |
4915 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
4916 | case SDL_COPY_BLEND: |
4917 | dstR = srcR + ((255 - srcA) * dstR) / 255; |
4918 | dstG = srcG + ((255 - srcA) * dstG) / 255; |
4919 | dstB = srcB + ((255 - srcA) * dstB) / 255; |
4920 | break; |
4921 | case SDL_COPY_ADD: |
4922 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
4923 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
4924 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
4925 | break; |
4926 | case SDL_COPY_MOD: |
4927 | dstR = (srcR * dstR) / 255; |
4928 | dstG = (srcG * dstG) / 255; |
4929 | dstB = (srcB * dstB) / 255; |
4930 | break; |
4931 | case SDL_COPY_MUL: |
4932 | dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255; |
4933 | dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255; |
4934 | dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255; |
4935 | break; |
4936 | } |
4937 | dstpixel = (dstR << 16) | (dstG << 8) | dstB; |
4938 | *dst = dstpixel; |
4939 | posx += incx; |
4940 | ++dst; |
4941 | } |
4942 | posy += incy; |
4943 | info->dst += info->dst_pitch; |
4944 | } |
4945 | } |
4946 | |
4947 | static void SDL_Blit_ABGR8888_BGR888_Scale(SDL_BlitInfo *info) |
4948 | { |
4949 | Uint32 pixel; |
4950 | Uint32 R, G, B; |
4951 | int srcy, srcx; |
4952 | Uint32 posy, posx; |
4953 | int incy, incx; |
4954 | |
4955 | incy = (info->src_h << 16) / info->dst_h; |
4956 | incx = (info->src_w << 16) / info->dst_w; |
4957 | posy = incy / 2; |
4958 | |
4959 | while (info->dst_h--) { |
4960 | Uint32 *src = 0; |
4961 | Uint32 *dst = (Uint32 *)info->dst; |
4962 | int n = info->dst_w; |
4963 | posx = incx / 2; |
4964 | |
4965 | srcy = posy >> 16; |
4966 | while (n--) { |
4967 | srcx = posx >> 16; |
4968 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
4969 | pixel = *src; |
4970 | B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; |
4971 | pixel = (B << 16) | (G << 8) | R; |
4972 | *dst = pixel; |
4973 | posx += incx; |
4974 | ++dst; |
4975 | } |
4976 | posy += incy; |
4977 | info->dst += info->dst_pitch; |
4978 | } |
4979 | } |
4980 | |
4981 | static void SDL_Blit_ABGR8888_BGR888_Blend(SDL_BlitInfo *info) |
4982 | { |
4983 | const int flags = info->flags; |
4984 | Uint32 srcpixel; |
4985 | Uint32 srcR, srcG, srcB, srcA; |
4986 | Uint32 dstpixel; |
4987 | Uint32 dstR, dstG, dstB; |
4988 | |
4989 | while (info->dst_h--) { |
4990 | Uint32 *src = (Uint32 *)info->src; |
4991 | Uint32 *dst = (Uint32 *)info->dst; |
4992 | int n = info->dst_w; |
4993 | while (n--) { |
4994 | srcpixel = *src; |
4995 | srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24); |
4996 | dstpixel = *dst; |
4997 | dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; |
4998 | if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
4999 | /* This goes away if we ever use premultiplied alpha */ |
5000 | if (srcA < 255) { |
5001 | srcR = (srcR * srcA) / 255; |
5002 | srcG = (srcG * srcA) / 255; |
5003 | srcB = (srcB * srcA) / 255; |
5004 | } |
5005 | } |
5006 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
5007 | case SDL_COPY_BLEND: |
5008 | dstR = srcR + ((255 - srcA) * dstR) / 255; |
5009 | dstG = srcG + ((255 - srcA) * dstG) / 255; |
5010 | dstB = srcB + ((255 - srcA) * dstB) / 255; |
5011 | break; |
5012 | case SDL_COPY_ADD: |
5013 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
5014 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
5015 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
5016 | break; |
5017 | case SDL_COPY_MOD: |
5018 | dstR = (srcR * dstR) / 255; |
5019 | dstG = (srcG * dstG) / 255; |
5020 | dstB = (srcB * dstB) / 255; |
5021 | break; |
5022 | case SDL_COPY_MUL: |
5023 | dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255; |
5024 | dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255; |
5025 | dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255; |
5026 | break; |
5027 | } |
5028 | dstpixel = (dstB << 16) | (dstG << 8) | dstR; |
5029 | *dst = dstpixel; |
5030 | ++src; |
5031 | ++dst; |
5032 | } |
5033 | info->src += info->src_pitch; |
5034 | info->dst += info->dst_pitch; |
5035 | } |
5036 | } |
5037 | |
5038 | static void SDL_Blit_ABGR8888_BGR888_Blend_Scale(SDL_BlitInfo *info) |
5039 | { |
5040 | const int flags = info->flags; |
5041 | Uint32 srcpixel; |
5042 | Uint32 srcR, srcG, srcB, srcA; |
5043 | Uint32 dstpixel; |
5044 | Uint32 dstR, dstG, dstB; |
5045 | int srcy, srcx; |
5046 | Uint32 posy, posx; |
5047 | int incy, incx; |
5048 | |
5049 | incy = (info->src_h << 16) / info->dst_h; |
5050 | incx = (info->src_w << 16) / info->dst_w; |
5051 | posy = incy / 2; |
5052 | |
5053 | while (info->dst_h--) { |
5054 | Uint32 *src = 0; |
5055 | Uint32 *dst = (Uint32 *)info->dst; |
5056 | int n = info->dst_w; |
5057 | posx = incx / 2; |
5058 | |
5059 | srcy = posy >> 16; |
5060 | while (n--) { |
5061 | srcx = posx >> 16; |
5062 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
5063 | srcpixel = *src; |
5064 | srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24); |
5065 | dstpixel = *dst; |
5066 | dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; |
5067 | if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
5068 | /* This goes away if we ever use premultiplied alpha */ |
5069 | if (srcA < 255) { |
5070 | srcR = (srcR * srcA) / 255; |
5071 | srcG = (srcG * srcA) / 255; |
5072 | srcB = (srcB * srcA) / 255; |
5073 | } |
5074 | } |
5075 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
5076 | case SDL_COPY_BLEND: |
5077 | dstR = srcR + ((255 - srcA) * dstR) / 255; |
5078 | dstG = srcG + ((255 - srcA) * dstG) / 255; |
5079 | dstB = srcB + ((255 - srcA) * dstB) / 255; |
5080 | break; |
5081 | case SDL_COPY_ADD: |
5082 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
5083 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
5084 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
5085 | break; |
5086 | case SDL_COPY_MOD: |
5087 | dstR = (srcR * dstR) / 255; |
5088 | dstG = (srcG * dstG) / 255; |
5089 | dstB = (srcB * dstB) / 255; |
5090 | break; |
5091 | case SDL_COPY_MUL: |
5092 | dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255; |
5093 | dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255; |
5094 | dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255; |
5095 | break; |
5096 | } |
5097 | dstpixel = (dstB << 16) | (dstG << 8) | dstR; |
5098 | *dst = dstpixel; |
5099 | posx += incx; |
5100 | ++dst; |
5101 | } |
5102 | posy += incy; |
5103 | info->dst += info->dst_pitch; |
5104 | } |
5105 | } |
5106 | |
5107 | static void SDL_Blit_ABGR8888_BGR888_Modulate(SDL_BlitInfo *info) |
5108 | { |
5109 | const int flags = info->flags; |
5110 | const Uint32 modulateR = info->r; |
5111 | const Uint32 modulateG = info->g; |
5112 | const Uint32 modulateB = info->b; |
5113 | Uint32 pixel; |
5114 | Uint32 R, G, B; |
5115 | |
5116 | while (info->dst_h--) { |
5117 | Uint32 *src = (Uint32 *)info->src; |
5118 | Uint32 *dst = (Uint32 *)info->dst; |
5119 | int n = info->dst_w; |
5120 | while (n--) { |
5121 | pixel = *src; |
5122 | B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; |
5123 | if (flags & SDL_COPY_MODULATE_COLOR) { |
5124 | R = (R * modulateR) / 255; |
5125 | G = (G * modulateG) / 255; |
5126 | B = (B * modulateB) / 255; |
5127 | } |
5128 | pixel = (B << 16) | (G << 8) | R; |
5129 | *dst = pixel; |
5130 | ++src; |
5131 | ++dst; |
5132 | } |
5133 | info->src += info->src_pitch; |
5134 | info->dst += info->dst_pitch; |
5135 | } |
5136 | } |
5137 | |
5138 | static void SDL_Blit_ABGR8888_BGR888_Modulate_Scale(SDL_BlitInfo *info) |
5139 | { |
5140 | const int flags = info->flags; |
5141 | const Uint32 modulateR = info->r; |
5142 | const Uint32 modulateG = info->g; |
5143 | const Uint32 modulateB = info->b; |
5144 | Uint32 pixel; |
5145 | Uint32 R, G, B; |
5146 | int srcy, srcx; |
5147 | Uint32 posy, posx; |
5148 | int incy, incx; |
5149 | |
5150 | incy = (info->src_h << 16) / info->dst_h; |
5151 | incx = (info->src_w << 16) / info->dst_w; |
5152 | posy = incy / 2; |
5153 | |
5154 | while (info->dst_h--) { |
5155 | Uint32 *src = 0; |
5156 | Uint32 *dst = (Uint32 *)info->dst; |
5157 | int n = info->dst_w; |
5158 | posx = incx / 2; |
5159 | |
5160 | srcy = posy >> 16; |
5161 | while (n--) { |
5162 | srcx = posx >> 16; |
5163 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
5164 | pixel = *src; |
5165 | B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; |
5166 | if (flags & SDL_COPY_MODULATE_COLOR) { |
5167 | R = (R * modulateR) / 255; |
5168 | G = (G * modulateG) / 255; |
5169 | B = (B * modulateB) / 255; |
5170 | } |
5171 | pixel = (B << 16) | (G << 8) | R; |
5172 | *dst = pixel; |
5173 | posx += incx; |
5174 | ++dst; |
5175 | } |
5176 | posy += incy; |
5177 | info->dst += info->dst_pitch; |
5178 | } |
5179 | } |
5180 | |
5181 | static void SDL_Blit_ABGR8888_BGR888_Modulate_Blend(SDL_BlitInfo *info) |
5182 | { |
5183 | const int flags = info->flags; |
5184 | const Uint32 modulateR = info->r; |
5185 | const Uint32 modulateG = info->g; |
5186 | const Uint32 modulateB = info->b; |
5187 | const Uint32 modulateA = info->a; |
5188 | Uint32 srcpixel; |
5189 | Uint32 srcR, srcG, srcB, srcA; |
5190 | Uint32 dstpixel; |
5191 | Uint32 dstR, dstG, dstB; |
5192 | |
5193 | while (info->dst_h--) { |
5194 | Uint32 *src = (Uint32 *)info->src; |
5195 | Uint32 *dst = (Uint32 *)info->dst; |
5196 | int n = info->dst_w; |
5197 | while (n--) { |
5198 | srcpixel = *src; |
5199 | srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24); |
5200 | dstpixel = *dst; |
5201 | dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; |
5202 | if (flags & SDL_COPY_MODULATE_COLOR) { |
5203 | srcR = (srcR * modulateR) / 255; |
5204 | srcG = (srcG * modulateG) / 255; |
5205 | srcB = (srcB * modulateB) / 255; |
5206 | } |
5207 | if (flags & SDL_COPY_MODULATE_ALPHA) { |
5208 | srcA = (srcA * modulateA) / 255; |
5209 | } |
5210 | if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
5211 | /* This goes away if we ever use premultiplied alpha */ |
5212 | if (srcA < 255) { |
5213 | srcR = (srcR * srcA) / 255; |
5214 | srcG = (srcG * srcA) / 255; |
5215 | srcB = (srcB * srcA) / 255; |
5216 | } |
5217 | } |
5218 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
5219 | case SDL_COPY_BLEND: |
5220 | dstR = srcR + ((255 - srcA) * dstR) / 255; |
5221 | dstG = srcG + ((255 - srcA) * dstG) / 255; |
5222 | dstB = srcB + ((255 - srcA) * dstB) / 255; |
5223 | break; |
5224 | case SDL_COPY_ADD: |
5225 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
5226 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
5227 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
5228 | break; |
5229 | case SDL_COPY_MOD: |
5230 | dstR = (srcR * dstR) / 255; |
5231 | dstG = (srcG * dstG) / 255; |
5232 | dstB = (srcB * dstB) / 255; |
5233 | break; |
5234 | case SDL_COPY_MUL: |
5235 | dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255; |
5236 | dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255; |
5237 | dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255; |
5238 | break; |
5239 | } |
5240 | dstpixel = (dstB << 16) | (dstG << 8) | dstR; |
5241 | *dst = dstpixel; |
5242 | ++src; |
5243 | ++dst; |
5244 | } |
5245 | info->src += info->src_pitch; |
5246 | info->dst += info->dst_pitch; |
5247 | } |
5248 | } |
5249 | |
5250 | static void SDL_Blit_ABGR8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info) |
5251 | { |
5252 | const int flags = info->flags; |
5253 | const Uint32 modulateR = info->r; |
5254 | const Uint32 modulateG = info->g; |
5255 | const Uint32 modulateB = info->b; |
5256 | const Uint32 modulateA = info->a; |
5257 | Uint32 srcpixel; |
5258 | Uint32 srcR, srcG, srcB, srcA; |
5259 | Uint32 dstpixel; |
5260 | Uint32 dstR, dstG, dstB; |
5261 | int srcy, srcx; |
5262 | Uint32 posy, posx; |
5263 | int incy, incx; |
5264 | |
5265 | incy = (info->src_h << 16) / info->dst_h; |
5266 | incx = (info->src_w << 16) / info->dst_w; |
5267 | posy = incy / 2; |
5268 | |
5269 | while (info->dst_h--) { |
5270 | Uint32 *src = 0; |
5271 | Uint32 *dst = (Uint32 *)info->dst; |
5272 | int n = info->dst_w; |
5273 | posx = incx / 2; |
5274 | |
5275 | srcy = posy >> 16; |
5276 | while (n--) { |
5277 | srcx = posx >> 16; |
5278 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
5279 | srcpixel = *src; |
5280 | srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24); |
5281 | dstpixel = *dst; |
5282 | dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; |
5283 | if (flags & SDL_COPY_MODULATE_COLOR) { |
5284 | srcR = (srcR * modulateR) / 255; |
5285 | srcG = (srcG * modulateG) / 255; |
5286 | srcB = (srcB * modulateB) / 255; |
5287 | } |
5288 | if (flags & SDL_COPY_MODULATE_ALPHA) { |
5289 | srcA = (srcA * modulateA) / 255; |
5290 | } |
5291 | if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
5292 | /* This goes away if we ever use premultiplied alpha */ |
5293 | if (srcA < 255) { |
5294 | srcR = (srcR * srcA) / 255; |
5295 | srcG = (srcG * srcA) / 255; |
5296 | srcB = (srcB * srcA) / 255; |
5297 | } |
5298 | } |
5299 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
5300 | case SDL_COPY_BLEND: |
5301 | dstR = srcR + ((255 - srcA) * dstR) / 255; |
5302 | dstG = srcG + ((255 - srcA) * dstG) / 255; |
5303 | dstB = srcB + ((255 - srcA) * dstB) / 255; |
5304 | break; |
5305 | case SDL_COPY_ADD: |
5306 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
5307 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
5308 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
5309 | break; |
5310 | case SDL_COPY_MOD: |
5311 | dstR = (srcR * dstR) / 255; |
5312 | dstG = (srcG * dstG) / 255; |
5313 | dstB = (srcB * dstB) / 255; |
5314 | break; |
5315 | case SDL_COPY_MUL: |
5316 | dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255; |
5317 | dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255; |
5318 | dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255; |
5319 | break; |
5320 | } |
5321 | dstpixel = (dstB << 16) | (dstG << 8) | dstR; |
5322 | *dst = dstpixel; |
5323 | posx += incx; |
5324 | ++dst; |
5325 | } |
5326 | posy += incy; |
5327 | info->dst += info->dst_pitch; |
5328 | } |
5329 | } |
5330 | |
5331 | static void SDL_Blit_ABGR8888_ARGB8888_Scale(SDL_BlitInfo *info) |
5332 | { |
5333 | Uint32 pixel; |
5334 | Uint32 R, G, B, A; |
5335 | int srcy, srcx; |
5336 | Uint32 posy, posx; |
5337 | int incy, incx; |
5338 | |
5339 | incy = (info->src_h << 16) / info->dst_h; |
5340 | incx = (info->src_w << 16) / info->dst_w; |
5341 | posy = incy / 2; |
5342 | |
5343 | while (info->dst_h--) { |
5344 | Uint32 *src = 0; |
5345 | Uint32 *dst = (Uint32 *)info->dst; |
5346 | int n = info->dst_w; |
5347 | posx = incx / 2; |
5348 | |
5349 | srcy = posy >> 16; |
5350 | while (n--) { |
5351 | srcx = posx >> 16; |
5352 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
5353 | pixel = *src; |
5354 | B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; A = (Uint8)(pixel >> 24); |
5355 | pixel = (A << 24) | (R << 16) | (G << 8) | B; |
5356 | *dst = pixel; |
5357 | posx += incx; |
5358 | ++dst; |
5359 | } |
5360 | posy += incy; |
5361 | info->dst += info->dst_pitch; |
5362 | } |
5363 | } |
5364 | |
5365 | static void SDL_Blit_ABGR8888_ARGB8888_Blend(SDL_BlitInfo *info) |
5366 | { |
5367 | const int flags = info->flags; |
5368 | Uint32 srcpixel; |
5369 | Uint32 srcR, srcG, srcB, srcA; |
5370 | Uint32 dstpixel; |
5371 | Uint32 dstR, dstG, dstB, dstA; |
5372 | |
5373 | while (info->dst_h--) { |
5374 | Uint32 *src = (Uint32 *)info->src; |
5375 | Uint32 *dst = (Uint32 *)info->dst; |
5376 | int n = info->dst_w; |
5377 | while (n--) { |
5378 | srcpixel = *src; |
5379 | srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24); |
5380 | dstpixel = *dst; |
5381 | dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24); |
5382 | if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
5383 | /* This goes away if we ever use premultiplied alpha */ |
5384 | if (srcA < 255) { |
5385 | srcR = (srcR * srcA) / 255; |
5386 | srcG = (srcG * srcA) / 255; |
5387 | srcB = (srcB * srcA) / 255; |
5388 | } |
5389 | } |
5390 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
5391 | case SDL_COPY_BLEND: |
5392 | dstR = srcR + ((255 - srcA) * dstR) / 255; |
5393 | dstG = srcG + ((255 - srcA) * dstG) / 255; |
5394 | dstB = srcB + ((255 - srcA) * dstB) / 255; |
5395 | dstA = srcA + ((255 - srcA) * dstA) / 255; |
5396 | break; |
5397 | case SDL_COPY_ADD: |
5398 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
5399 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
5400 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
5401 | break; |
5402 | case SDL_COPY_MOD: |
5403 | dstR = (srcR * dstR) / 255; |
5404 | dstG = (srcG * dstG) / 255; |
5405 | dstB = (srcB * dstB) / 255; |
5406 | break; |
5407 | case SDL_COPY_MUL: |
5408 | dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255; |
5409 | dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255; |
5410 | dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255; |
5411 | dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) dstA = 255; |
5412 | break; |
5413 | } |
5414 | dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB; |
5415 | *dst = dstpixel; |
5416 | ++src; |
5417 | ++dst; |
5418 | } |
5419 | info->src += info->src_pitch; |
5420 | info->dst += info->dst_pitch; |
5421 | } |
5422 | } |
5423 | |
5424 | static void SDL_Blit_ABGR8888_ARGB8888_Blend_Scale(SDL_BlitInfo *info) |
5425 | { |
5426 | const int flags = info->flags; |
5427 | Uint32 srcpixel; |
5428 | Uint32 srcR, srcG, srcB, srcA; |
5429 | Uint32 dstpixel; |
5430 | Uint32 dstR, dstG, dstB, dstA; |
5431 | int srcy, srcx; |
5432 | Uint32 posy, posx; |
5433 | int incy, incx; |
5434 | |
5435 | incy = (info->src_h << 16) / info->dst_h; |
5436 | incx = (info->src_w << 16) / info->dst_w; |
5437 | posy = incy / 2; |
5438 | |
5439 | while (info->dst_h--) { |
5440 | Uint32 *src = 0; |
5441 | Uint32 *dst = (Uint32 *)info->dst; |
5442 | int n = info->dst_w; |
5443 | posx = incx / 2; |
5444 | |
5445 | srcy = posy >> 16; |
5446 | while (n--) { |
5447 | srcx = posx >> 16; |
5448 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
5449 | srcpixel = *src; |
5450 | srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24); |
5451 | dstpixel = *dst; |
5452 | dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24); |
5453 | if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
5454 | /* This goes away if we ever use premultiplied alpha */ |
5455 | if (srcA < 255) { |
5456 | srcR = (srcR * srcA) / 255; |
5457 | srcG = (srcG * srcA) / 255; |
5458 | srcB = (srcB * srcA) / 255; |
5459 | } |
5460 | } |
5461 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
5462 | case SDL_COPY_BLEND: |
5463 | dstR = srcR + ((255 - srcA) * dstR) / 255; |
5464 | dstG = srcG + ((255 - srcA) * dstG) / 255; |
5465 | dstB = srcB + ((255 - srcA) * dstB) / 255; |
5466 | dstA = srcA + ((255 - srcA) * dstA) / 255; |
5467 | break; |
5468 | case SDL_COPY_ADD: |
5469 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
5470 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
5471 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
5472 | break; |
5473 | case SDL_COPY_MOD: |
5474 | dstR = (srcR * dstR) / 255; |
5475 | dstG = (srcG * dstG) / 255; |
5476 | dstB = (srcB * dstB) / 255; |
5477 | break; |
5478 | case SDL_COPY_MUL: |
5479 | dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255; |
5480 | dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255; |
5481 | dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255; |
5482 | dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) dstA = 255; |
5483 | break; |
5484 | } |
5485 | dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB; |
5486 | *dst = dstpixel; |
5487 | posx += incx; |
5488 | ++dst; |
5489 | } |
5490 | posy += incy; |
5491 | info->dst += info->dst_pitch; |
5492 | } |
5493 | } |
5494 | |
5495 | static void SDL_Blit_ABGR8888_ARGB8888_Modulate(SDL_BlitInfo *info) |
5496 | { |
5497 | const int flags = info->flags; |
5498 | const Uint32 modulateR = info->r; |
5499 | const Uint32 modulateG = info->g; |
5500 | const Uint32 modulateB = info->b; |
5501 | const Uint32 modulateA = info->a; |
5502 | Uint32 pixel; |
5503 | Uint32 R, G, B, A; |
5504 | |
5505 | while (info->dst_h--) { |
5506 | Uint32 *src = (Uint32 *)info->src; |
5507 | Uint32 *dst = (Uint32 *)info->dst; |
5508 | int n = info->dst_w; |
5509 | while (n--) { |
5510 | pixel = *src; |
5511 | B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; A = (Uint8)(pixel >> 24); |
5512 | if (flags & SDL_COPY_MODULATE_COLOR) { |
5513 | R = (R * modulateR) / 255; |
5514 | G = (G * modulateG) / 255; |
5515 | B = (B * modulateB) / 255; |
5516 | } |
5517 | if (flags & SDL_COPY_MODULATE_ALPHA) { |
5518 | A = (A * modulateA) / 255; |
5519 | } |
5520 | pixel = (A << 24) | (R << 16) | (G << 8) | B; |
5521 | *dst = pixel; |
5522 | ++src; |
5523 | ++dst; |
5524 | } |
5525 | info->src += info->src_pitch; |
5526 | info->dst += info->dst_pitch; |
5527 | } |
5528 | } |
5529 | |
5530 | static void SDL_Blit_ABGR8888_ARGB8888_Modulate_Scale(SDL_BlitInfo *info) |
5531 | { |
5532 | const int flags = info->flags; |
5533 | const Uint32 modulateR = info->r; |
5534 | const Uint32 modulateG = info->g; |
5535 | const Uint32 modulateB = info->b; |
5536 | const Uint32 modulateA = info->a; |
5537 | Uint32 pixel; |
5538 | Uint32 R, G, B, A; |
5539 | int srcy, srcx; |
5540 | Uint32 posy, posx; |
5541 | int incy, incx; |
5542 | |
5543 | incy = (info->src_h << 16) / info->dst_h; |
5544 | incx = (info->src_w << 16) / info->dst_w; |
5545 | posy = incy / 2; |
5546 | |
5547 | while (info->dst_h--) { |
5548 | Uint32 *src = 0; |
5549 | Uint32 *dst = (Uint32 *)info->dst; |
5550 | int n = info->dst_w; |
5551 | posx = incx / 2; |
5552 | |
5553 | srcy = posy >> 16; |
5554 | while (n--) { |
5555 | srcx = posx >> 16; |
5556 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
5557 | pixel = *src; |
5558 | B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; A = (Uint8)(pixel >> 24); |
5559 | if (flags & SDL_COPY_MODULATE_COLOR) { |
5560 | R = (R * modulateR) / 255; |
5561 | G = (G * modulateG) / 255; |
5562 | B = (B * modulateB) / 255; |
5563 | } |
5564 | if (flags & SDL_COPY_MODULATE_ALPHA) { |
5565 | A = (A * modulateA) / 255; |
5566 | } |
5567 | pixel = (A << 24) | (R << 16) | (G << 8) | B; |
5568 | *dst = pixel; |
5569 | posx += incx; |
5570 | ++dst; |
5571 | } |
5572 | posy += incy; |
5573 | info->dst += info->dst_pitch; |
5574 | } |
5575 | } |
5576 | |
5577 | static void SDL_Blit_ABGR8888_ARGB8888_Modulate_Blend(SDL_BlitInfo *info) |
5578 | { |
5579 | const int flags = info->flags; |
5580 | const Uint32 modulateR = info->r; |
5581 | const Uint32 modulateG = info->g; |
5582 | const Uint32 modulateB = info->b; |
5583 | const Uint32 modulateA = info->a; |
5584 | Uint32 srcpixel; |
5585 | Uint32 srcR, srcG, srcB, srcA; |
5586 | Uint32 dstpixel; |
5587 | Uint32 dstR, dstG, dstB, dstA; |
5588 | |
5589 | while (info->dst_h--) { |
5590 | Uint32 *src = (Uint32 *)info->src; |
5591 | Uint32 *dst = (Uint32 *)info->dst; |
5592 | int n = info->dst_w; |
5593 | while (n--) { |
5594 | srcpixel = *src; |
5595 | srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24); |
5596 | dstpixel = *dst; |
5597 | dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24); |
5598 | if (flags & SDL_COPY_MODULATE_COLOR) { |
5599 | srcR = (srcR * modulateR) / 255; |
5600 | srcG = (srcG * modulateG) / 255; |
5601 | srcB = (srcB * modulateB) / 255; |
5602 | } |
5603 | if (flags & SDL_COPY_MODULATE_ALPHA) { |
5604 | srcA = (srcA * modulateA) / 255; |
5605 | } |
5606 | if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
5607 | /* This goes away if we ever use premultiplied alpha */ |
5608 | if (srcA < 255) { |
5609 | srcR = (srcR * srcA) / 255; |
5610 | srcG = (srcG * srcA) / 255; |
5611 | srcB = (srcB * srcA) / 255; |
5612 | } |
5613 | } |
5614 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
5615 | case SDL_COPY_BLEND: |
5616 | dstR = srcR + ((255 - srcA) * dstR) / 255; |
5617 | dstG = srcG + ((255 - srcA) * dstG) / 255; |
5618 | dstB = srcB + ((255 - srcA) * dstB) / 255; |
5619 | dstA = srcA + ((255 - srcA) * dstA) / 255; |
5620 | break; |
5621 | case SDL_COPY_ADD: |
5622 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
5623 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
5624 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
5625 | break; |
5626 | case SDL_COPY_MOD: |
5627 | dstR = (srcR * dstR) / 255; |
5628 | dstG = (srcG * dstG) / 255; |
5629 | dstB = (srcB * dstB) / 255; |
5630 | break; |
5631 | case SDL_COPY_MUL: |
5632 | dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255; |
5633 | dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255; |
5634 | dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255; |
5635 | dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) dstA = 255; |
5636 | break; |
5637 | } |
5638 | dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB; |
5639 | *dst = dstpixel; |
5640 | ++src; |
5641 | ++dst; |
5642 | } |
5643 | info->src += info->src_pitch; |
5644 | info->dst += info->dst_pitch; |
5645 | } |
5646 | } |
5647 | |
5648 | static void SDL_Blit_ABGR8888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info) |
5649 | { |
5650 | const int flags = info->flags; |
5651 | const Uint32 modulateR = info->r; |
5652 | const Uint32 modulateG = info->g; |
5653 | const Uint32 modulateB = info->b; |
5654 | const Uint32 modulateA = info->a; |
5655 | Uint32 srcpixel; |
5656 | Uint32 srcR, srcG, srcB, srcA; |
5657 | Uint32 dstpixel; |
5658 | Uint32 dstR, dstG, dstB, dstA; |
5659 | int srcy, srcx; |
5660 | Uint32 posy, posx; |
5661 | int incy, incx; |
5662 | |
5663 | incy = (info->src_h << 16) / info->dst_h; |
5664 | incx = (info->src_w << 16) / info->dst_w; |
5665 | posy = incy / 2; |
5666 | |
5667 | while (info->dst_h--) { |
5668 | Uint32 *src = 0; |
5669 | Uint32 *dst = (Uint32 *)info->dst; |
5670 | int n = info->dst_w; |
5671 | posx = incx / 2; |
5672 | |
5673 | srcy = posy >> 16; |
5674 | while (n--) { |
5675 | srcx = posx >> 16; |
5676 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
5677 | srcpixel = *src; |
5678 | srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24); |
5679 | dstpixel = *dst; |
5680 | dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24); |
5681 | if (flags & SDL_COPY_MODULATE_COLOR) { |
5682 | srcR = (srcR * modulateR) / 255; |
5683 | srcG = (srcG * modulateG) / 255; |
5684 | srcB = (srcB * modulateB) / 255; |
5685 | } |
5686 | if (flags & SDL_COPY_MODULATE_ALPHA) { |
5687 | srcA = (srcA * modulateA) / 255; |
5688 | } |
5689 | if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
5690 | /* This goes away if we ever use premultiplied alpha */ |
5691 | if (srcA < 255) { |
5692 | srcR = (srcR * srcA) / 255; |
5693 | srcG = (srcG * srcA) / 255; |
5694 | srcB = (srcB * srcA) / 255; |
5695 | } |
5696 | } |
5697 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
5698 | case SDL_COPY_BLEND: |
5699 | dstR = srcR + ((255 - srcA) * dstR) / 255; |
5700 | dstG = srcG + ((255 - srcA) * dstG) / 255; |
5701 | dstB = srcB + ((255 - srcA) * dstB) / 255; |
5702 | dstA = srcA + ((255 - srcA) * dstA) / 255; |
5703 | break; |
5704 | case SDL_COPY_ADD: |
5705 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
5706 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
5707 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
5708 | break; |
5709 | case SDL_COPY_MOD: |
5710 | dstR = (srcR * dstR) / 255; |
5711 | dstG = (srcG * dstG) / 255; |
5712 | dstB = (srcB * dstB) / 255; |
5713 | break; |
5714 | case SDL_COPY_MUL: |
5715 | dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255; |
5716 | dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255; |
5717 | dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255; |
5718 | dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) dstA = 255; |
5719 | break; |
5720 | } |
5721 | dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB; |
5722 | *dst = dstpixel; |
5723 | posx += incx; |
5724 | ++dst; |
5725 | } |
5726 | posy += incy; |
5727 | info->dst += info->dst_pitch; |
5728 | } |
5729 | } |
5730 | |
5731 | static void SDL_Blit_BGRA8888_RGB888_Scale(SDL_BlitInfo *info) |
5732 | { |
5733 | Uint32 pixel; |
5734 | Uint32 R, G, B; |
5735 | int srcy, srcx; |
5736 | Uint32 posy, posx; |
5737 | int incy, incx; |
5738 | |
5739 | incy = (info->src_h << 16) / info->dst_h; |
5740 | incx = (info->src_w << 16) / info->dst_w; |
5741 | posy = incy / 2; |
5742 | |
5743 | while (info->dst_h--) { |
5744 | Uint32 *src = 0; |
5745 | Uint32 *dst = (Uint32 *)info->dst; |
5746 | int n = info->dst_w; |
5747 | posx = incx / 2; |
5748 | |
5749 | srcy = posy >> 16; |
5750 | while (n--) { |
5751 | srcx = posx >> 16; |
5752 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
5753 | pixel = *src; |
5754 | B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); |
5755 | pixel = (R << 16) | (G << 8) | B; |
5756 | *dst = pixel; |
5757 | posx += incx; |
5758 | ++dst; |
5759 | } |
5760 | posy += incy; |
5761 | info->dst += info->dst_pitch; |
5762 | } |
5763 | } |
5764 | |
5765 | static void SDL_Blit_BGRA8888_RGB888_Blend(SDL_BlitInfo *info) |
5766 | { |
5767 | const int flags = info->flags; |
5768 | Uint32 srcpixel; |
5769 | Uint32 srcR, srcG, srcB, srcA; |
5770 | Uint32 dstpixel; |
5771 | Uint32 dstR, dstG, dstB; |
5772 | |
5773 | while (info->dst_h--) { |
5774 | Uint32 *src = (Uint32 *)info->src; |
5775 | Uint32 *dst = (Uint32 *)info->dst; |
5776 | int n = info->dst_w; |
5777 | while (n--) { |
5778 | srcpixel = *src; |
5779 | srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; |
5780 | dstpixel = *dst; |
5781 | dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; |
5782 | if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
5783 | /* This goes away if we ever use premultiplied alpha */ |
5784 | if (srcA < 255) { |
5785 | srcR = (srcR * srcA) / 255; |
5786 | srcG = (srcG * srcA) / 255; |
5787 | srcB = (srcB * srcA) / 255; |
5788 | } |
5789 | } |
5790 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
5791 | case SDL_COPY_BLEND: |
5792 | dstR = srcR + ((255 - srcA) * dstR) / 255; |
5793 | dstG = srcG + ((255 - srcA) * dstG) / 255; |
5794 | dstB = srcB + ((255 - srcA) * dstB) / 255; |
5795 | break; |
5796 | case SDL_COPY_ADD: |
5797 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
5798 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
5799 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
5800 | break; |
5801 | case SDL_COPY_MOD: |
5802 | dstR = (srcR * dstR) / 255; |
5803 | dstG = (srcG * dstG) / 255; |
5804 | dstB = (srcB * dstB) / 255; |
5805 | break; |
5806 | case SDL_COPY_MUL: |
5807 | dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255; |
5808 | dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255; |
5809 | dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255; |
5810 | break; |
5811 | } |
5812 | dstpixel = (dstR << 16) | (dstG << 8) | dstB; |
5813 | *dst = dstpixel; |
5814 | ++src; |
5815 | ++dst; |
5816 | } |
5817 | info->src += info->src_pitch; |
5818 | info->dst += info->dst_pitch; |
5819 | } |
5820 | } |
5821 | |
5822 | static void SDL_Blit_BGRA8888_RGB888_Blend_Scale(SDL_BlitInfo *info) |
5823 | { |
5824 | const int flags = info->flags; |
5825 | Uint32 srcpixel; |
5826 | Uint32 srcR, srcG, srcB, srcA; |
5827 | Uint32 dstpixel; |
5828 | Uint32 dstR, dstG, dstB; |
5829 | int srcy, srcx; |
5830 | Uint32 posy, posx; |
5831 | int incy, incx; |
5832 | |
5833 | incy = (info->src_h << 16) / info->dst_h; |
5834 | incx = (info->src_w << 16) / info->dst_w; |
5835 | posy = incy / 2; |
5836 | |
5837 | while (info->dst_h--) { |
5838 | Uint32 *src = 0; |
5839 | Uint32 *dst = (Uint32 *)info->dst; |
5840 | int n = info->dst_w; |
5841 | posx = incx / 2; |
5842 | |
5843 | srcy = posy >> 16; |
5844 | while (n--) { |
5845 | srcx = posx >> 16; |
5846 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
5847 | srcpixel = *src; |
5848 | srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; |
5849 | dstpixel = *dst; |
5850 | dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; |
5851 | if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
5852 | /* This goes away if we ever use premultiplied alpha */ |
5853 | if (srcA < 255) { |
5854 | srcR = (srcR * srcA) / 255; |
5855 | srcG = (srcG * srcA) / 255; |
5856 | srcB = (srcB * srcA) / 255; |
5857 | } |
5858 | } |
5859 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
5860 | case SDL_COPY_BLEND: |
5861 | dstR = srcR + ((255 - srcA) * dstR) / 255; |
5862 | dstG = srcG + ((255 - srcA) * dstG) / 255; |
5863 | dstB = srcB + ((255 - srcA) * dstB) / 255; |
5864 | break; |
5865 | case SDL_COPY_ADD: |
5866 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
5867 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
5868 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
5869 | break; |
5870 | case SDL_COPY_MOD: |
5871 | dstR = (srcR * dstR) / 255; |
5872 | dstG = (srcG * dstG) / 255; |
5873 | dstB = (srcB * dstB) / 255; |
5874 | break; |
5875 | case SDL_COPY_MUL: |
5876 | dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255; |
5877 | dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255; |
5878 | dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255; |
5879 | break; |
5880 | } |
5881 | dstpixel = (dstR << 16) | (dstG << 8) | dstB; |
5882 | *dst = dstpixel; |
5883 | posx += incx; |
5884 | ++dst; |
5885 | } |
5886 | posy += incy; |
5887 | info->dst += info->dst_pitch; |
5888 | } |
5889 | } |
5890 | |
5891 | static void SDL_Blit_BGRA8888_RGB888_Modulate(SDL_BlitInfo *info) |
5892 | { |
5893 | const int flags = info->flags; |
5894 | const Uint32 modulateR = info->r; |
5895 | const Uint32 modulateG = info->g; |
5896 | const Uint32 modulateB = info->b; |
5897 | Uint32 pixel; |
5898 | Uint32 R, G, B; |
5899 | |
5900 | while (info->dst_h--) { |
5901 | Uint32 *src = (Uint32 *)info->src; |
5902 | Uint32 *dst = (Uint32 *)info->dst; |
5903 | int n = info->dst_w; |
5904 | while (n--) { |
5905 | pixel = *src; |
5906 | B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); |
5907 | if (flags & SDL_COPY_MODULATE_COLOR) { |
5908 | R = (R * modulateR) / 255; |
5909 | G = (G * modulateG) / 255; |
5910 | B = (B * modulateB) / 255; |
5911 | } |
5912 | pixel = (R << 16) | (G << 8) | B; |
5913 | *dst = pixel; |
5914 | ++src; |
5915 | ++dst; |
5916 | } |
5917 | info->src += info->src_pitch; |
5918 | info->dst += info->dst_pitch; |
5919 | } |
5920 | } |
5921 | |
5922 | static void SDL_Blit_BGRA8888_RGB888_Modulate_Scale(SDL_BlitInfo *info) |
5923 | { |
5924 | const int flags = info->flags; |
5925 | const Uint32 modulateR = info->r; |
5926 | const Uint32 modulateG = info->g; |
5927 | const Uint32 modulateB = info->b; |
5928 | Uint32 pixel; |
5929 | Uint32 R, G, B; |
5930 | int srcy, srcx; |
5931 | Uint32 posy, posx; |
5932 | int incy, incx; |
5933 | |
5934 | incy = (info->src_h << 16) / info->dst_h; |
5935 | incx = (info->src_w << 16) / info->dst_w; |
5936 | posy = incy / 2; |
5937 | |
5938 | while (info->dst_h--) { |
5939 | Uint32 *src = 0; |
5940 | Uint32 *dst = (Uint32 *)info->dst; |
5941 | int n = info->dst_w; |
5942 | posx = incx / 2; |
5943 | |
5944 | srcy = posy >> 16; |
5945 | while (n--) { |
5946 | srcx = posx >> 16; |
5947 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
5948 | pixel = *src; |
5949 | B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); |
5950 | if (flags & SDL_COPY_MODULATE_COLOR) { |
5951 | R = (R * modulateR) / 255; |
5952 | G = (G * modulateG) / 255; |
5953 | B = (B * modulateB) / 255; |
5954 | } |
5955 | pixel = (R << 16) | (G << 8) | B; |
5956 | *dst = pixel; |
5957 | posx += incx; |
5958 | ++dst; |
5959 | } |
5960 | posy += incy; |
5961 | info->dst += info->dst_pitch; |
5962 | } |
5963 | } |
5964 | |
5965 | static void SDL_Blit_BGRA8888_RGB888_Modulate_Blend(SDL_BlitInfo *info) |
5966 | { |
5967 | const int flags = info->flags; |
5968 | const Uint32 modulateR = info->r; |
5969 | const Uint32 modulateG = info->g; |
5970 | const Uint32 modulateB = info->b; |
5971 | const Uint32 modulateA = info->a; |
5972 | Uint32 srcpixel; |
5973 | Uint32 srcR, srcG, srcB, srcA; |
5974 | Uint32 dstpixel; |
5975 | Uint32 dstR, dstG, dstB; |
5976 | |
5977 | while (info->dst_h--) { |
5978 | Uint32 *src = (Uint32 *)info->src; |
5979 | Uint32 *dst = (Uint32 *)info->dst; |
5980 | int n = info->dst_w; |
5981 | while (n--) { |
5982 | srcpixel = *src; |
5983 | srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; |
5984 | dstpixel = *dst; |
5985 | dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; |
5986 | if (flags & SDL_COPY_MODULATE_COLOR) { |
5987 | srcR = (srcR * modulateR) / 255; |
5988 | srcG = (srcG * modulateG) / 255; |
5989 | srcB = (srcB * modulateB) / 255; |
5990 | } |
5991 | if (flags & SDL_COPY_MODULATE_ALPHA) { |
5992 | srcA = (srcA * modulateA) / 255; |
5993 | } |
5994 | if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
5995 | /* This goes away if we ever use premultiplied alpha */ |
5996 | if (srcA < 255) { |
5997 | srcR = (srcR * srcA) / 255; |
5998 | srcG = (srcG * srcA) / 255; |
5999 | srcB = (srcB * srcA) / 255; |
6000 | } |
6001 | } |
6002 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
6003 | case SDL_COPY_BLEND: |
6004 | dstR = srcR + ((255 - srcA) * dstR) / 255; |
6005 | dstG = srcG + ((255 - srcA) * dstG) / 255; |
6006 | dstB = srcB + ((255 - srcA) * dstB) / 255; |
6007 | break; |
6008 | case SDL_COPY_ADD: |
6009 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
6010 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
6011 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
6012 | break; |
6013 | case SDL_COPY_MOD: |
6014 | dstR = (srcR * dstR) / 255; |
6015 | dstG = (srcG * dstG) / 255; |
6016 | dstB = (srcB * dstB) / 255; |
6017 | break; |
6018 | case SDL_COPY_MUL: |
6019 | dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255; |
6020 | dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255; |
6021 | dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255; |
6022 | break; |
6023 | } |
6024 | dstpixel = (dstR << 16) | (dstG << 8) | dstB; |
6025 | *dst = dstpixel; |
6026 | ++src; |
6027 | ++dst; |
6028 | } |
6029 | info->src += info->src_pitch; |
6030 | info->dst += info->dst_pitch; |
6031 | } |
6032 | } |
6033 | |
6034 | static void SDL_Blit_BGRA8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info) |
6035 | { |
6036 | const int flags = info->flags; |
6037 | const Uint32 modulateR = info->r; |
6038 | const Uint32 modulateG = info->g; |
6039 | const Uint32 modulateB = info->b; |
6040 | const Uint32 modulateA = info->a; |
6041 | Uint32 srcpixel; |
6042 | Uint32 srcR, srcG, srcB, srcA; |
6043 | Uint32 dstpixel; |
6044 | Uint32 dstR, dstG, dstB; |
6045 | int srcy, srcx; |
6046 | Uint32 posy, posx; |
6047 | int incy, incx; |
6048 | |
6049 | incy = (info->src_h << 16) / info->dst_h; |
6050 | incx = (info->src_w << 16) / info->dst_w; |
6051 | posy = incy / 2; |
6052 | |
6053 | while (info->dst_h--) { |
6054 | Uint32 *src = 0; |
6055 | Uint32 *dst = (Uint32 *)info->dst; |
6056 | int n = info->dst_w; |
6057 | posx = incx / 2; |
6058 | |
6059 | srcy = posy >> 16; |
6060 | while (n--) { |
6061 | srcx = posx >> 16; |
6062 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
6063 | srcpixel = *src; |
6064 | srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; |
6065 | dstpixel = *dst; |
6066 | dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; |
6067 | if (flags & SDL_COPY_MODULATE_COLOR) { |
6068 | srcR = (srcR * modulateR) / 255; |
6069 | srcG = (srcG * modulateG) / 255; |
6070 | srcB = (srcB * modulateB) / 255; |
6071 | } |
6072 | if (flags & SDL_COPY_MODULATE_ALPHA) { |
6073 | srcA = (srcA * modulateA) / 255; |
6074 | } |
6075 | if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
6076 | /* This goes away if we ever use premultiplied alpha */ |
6077 | if (srcA < 255) { |
6078 | srcR = (srcR * srcA) / 255; |
6079 | srcG = (srcG * srcA) / 255; |
6080 | srcB = (srcB * srcA) / 255; |
6081 | } |
6082 | } |
6083 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
6084 | case SDL_COPY_BLEND: |
6085 | dstR = srcR + ((255 - srcA) * dstR) / 255; |
6086 | dstG = srcG + ((255 - srcA) * dstG) / 255; |
6087 | dstB = srcB + ((255 - srcA) * dstB) / 255; |
6088 | break; |
6089 | case SDL_COPY_ADD: |
6090 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
6091 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
6092 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
6093 | break; |
6094 | case SDL_COPY_MOD: |
6095 | dstR = (srcR * dstR) / 255; |
6096 | dstG = (srcG * dstG) / 255; |
6097 | dstB = (srcB * dstB) / 255; |
6098 | break; |
6099 | case SDL_COPY_MUL: |
6100 | dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255; |
6101 | dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255; |
6102 | dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255; |
6103 | break; |
6104 | } |
6105 | dstpixel = (dstR << 16) | (dstG << 8) | dstB; |
6106 | *dst = dstpixel; |
6107 | posx += incx; |
6108 | ++dst; |
6109 | } |
6110 | posy += incy; |
6111 | info->dst += info->dst_pitch; |
6112 | } |
6113 | } |
6114 | |
6115 | static void SDL_Blit_BGRA8888_BGR888_Scale(SDL_BlitInfo *info) |
6116 | { |
6117 | Uint32 pixel; |
6118 | Uint32 R, G, B; |
6119 | int srcy, srcx; |
6120 | Uint32 posy, posx; |
6121 | int incy, incx; |
6122 | |
6123 | incy = (info->src_h << 16) / info->dst_h; |
6124 | incx = (info->src_w << 16) / info->dst_w; |
6125 | posy = incy / 2; |
6126 | |
6127 | while (info->dst_h--) { |
6128 | Uint32 *src = 0; |
6129 | Uint32 *dst = (Uint32 *)info->dst; |
6130 | int n = info->dst_w; |
6131 | posx = incx / 2; |
6132 | |
6133 | srcy = posy >> 16; |
6134 | while (n--) { |
6135 | srcx = posx >> 16; |
6136 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
6137 | pixel = *src; |
6138 | B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); |
6139 | pixel = (B << 16) | (G << 8) | R; |
6140 | *dst = pixel; |
6141 | posx += incx; |
6142 | ++dst; |
6143 | } |
6144 | posy += incy; |
6145 | info->dst += info->dst_pitch; |
6146 | } |
6147 | } |
6148 | |
6149 | static void SDL_Blit_BGRA8888_BGR888_Blend(SDL_BlitInfo *info) |
6150 | { |
6151 | const int flags = info->flags; |
6152 | Uint32 srcpixel; |
6153 | Uint32 srcR, srcG, srcB, srcA; |
6154 | Uint32 dstpixel; |
6155 | Uint32 dstR, dstG, dstB; |
6156 | |
6157 | while (info->dst_h--) { |
6158 | Uint32 *src = (Uint32 *)info->src; |
6159 | Uint32 *dst = (Uint32 *)info->dst; |
6160 | int n = info->dst_w; |
6161 | while (n--) { |
6162 | srcpixel = *src; |
6163 | srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; |
6164 | dstpixel = *dst; |
6165 | dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; |
6166 | if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
6167 | /* This goes away if we ever use premultiplied alpha */ |
6168 | if (srcA < 255) { |
6169 | srcR = (srcR * srcA) / 255; |
6170 | srcG = (srcG * srcA) / 255; |
6171 | srcB = (srcB * srcA) / 255; |
6172 | } |
6173 | } |
6174 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
6175 | case SDL_COPY_BLEND: |
6176 | dstR = srcR + ((255 - srcA) * dstR) / 255; |
6177 | dstG = srcG + ((255 - srcA) * dstG) / 255; |
6178 | dstB = srcB + ((255 - srcA) * dstB) / 255; |
6179 | break; |
6180 | case SDL_COPY_ADD: |
6181 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
6182 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
6183 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
6184 | break; |
6185 | case SDL_COPY_MOD: |
6186 | dstR = (srcR * dstR) / 255; |
6187 | dstG = (srcG * dstG) / 255; |
6188 | dstB = (srcB * dstB) / 255; |
6189 | break; |
6190 | case SDL_COPY_MUL: |
6191 | dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255; |
6192 | dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255; |
6193 | dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255; |
6194 | break; |
6195 | } |
6196 | dstpixel = (dstB << 16) | (dstG << 8) | dstR; |
6197 | *dst = dstpixel; |
6198 | ++src; |
6199 | ++dst; |
6200 | } |
6201 | info->src += info->src_pitch; |
6202 | info->dst += info->dst_pitch; |
6203 | } |
6204 | } |
6205 | |
6206 | static void SDL_Blit_BGRA8888_BGR888_Blend_Scale(SDL_BlitInfo *info) |
6207 | { |
6208 | const int flags = info->flags; |
6209 | Uint32 srcpixel; |
6210 | Uint32 srcR, srcG, srcB, srcA; |
6211 | Uint32 dstpixel; |
6212 | Uint32 dstR, dstG, dstB; |
6213 | int srcy, srcx; |
6214 | Uint32 posy, posx; |
6215 | int incy, incx; |
6216 | |
6217 | incy = (info->src_h << 16) / info->dst_h; |
6218 | incx = (info->src_w << 16) / info->dst_w; |
6219 | posy = incy / 2; |
6220 | |
6221 | while (info->dst_h--) { |
6222 | Uint32 *src = 0; |
6223 | Uint32 *dst = (Uint32 *)info->dst; |
6224 | int n = info->dst_w; |
6225 | posx = incx / 2; |
6226 | |
6227 | srcy = posy >> 16; |
6228 | while (n--) { |
6229 | srcx = posx >> 16; |
6230 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
6231 | srcpixel = *src; |
6232 | srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; |
6233 | dstpixel = *dst; |
6234 | dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; |
6235 | if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
6236 | /* This goes away if we ever use premultiplied alpha */ |
6237 | if (srcA < 255) { |
6238 | srcR = (srcR * srcA) / 255; |
6239 | srcG = (srcG * srcA) / 255; |
6240 | srcB = (srcB * srcA) / 255; |
6241 | } |
6242 | } |
6243 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
6244 | case SDL_COPY_BLEND: |
6245 | dstR = srcR + ((255 - srcA) * dstR) / 255; |
6246 | dstG = srcG + ((255 - srcA) * dstG) / 255; |
6247 | dstB = srcB + ((255 - srcA) * dstB) / 255; |
6248 | break; |
6249 | case SDL_COPY_ADD: |
6250 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
6251 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
6252 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
6253 | break; |
6254 | case SDL_COPY_MOD: |
6255 | dstR = (srcR * dstR) / 255; |
6256 | dstG = (srcG * dstG) / 255; |
6257 | dstB = (srcB * dstB) / 255; |
6258 | break; |
6259 | case SDL_COPY_MUL: |
6260 | dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255; |
6261 | dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255; |
6262 | dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255; |
6263 | break; |
6264 | } |
6265 | dstpixel = (dstB << 16) | (dstG << 8) | dstR; |
6266 | *dst = dstpixel; |
6267 | posx += incx; |
6268 | ++dst; |
6269 | } |
6270 | posy += incy; |
6271 | info->dst += info->dst_pitch; |
6272 | } |
6273 | } |
6274 | |
6275 | static void SDL_Blit_BGRA8888_BGR888_Modulate(SDL_BlitInfo *info) |
6276 | { |
6277 | const int flags = info->flags; |
6278 | const Uint32 modulateR = info->r; |
6279 | const Uint32 modulateG = info->g; |
6280 | const Uint32 modulateB = info->b; |
6281 | Uint32 pixel; |
6282 | Uint32 R, G, B; |
6283 | |
6284 | while (info->dst_h--) { |
6285 | Uint32 *src = (Uint32 *)info->src; |
6286 | Uint32 *dst = (Uint32 *)info->dst; |
6287 | int n = info->dst_w; |
6288 | while (n--) { |
6289 | pixel = *src; |
6290 | B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); |
6291 | if (flags & SDL_COPY_MODULATE_COLOR) { |
6292 | R = (R * modulateR) / 255; |
6293 | G = (G * modulateG) / 255; |
6294 | B = (B * modulateB) / 255; |
6295 | } |
6296 | pixel = (B << 16) | (G << 8) | R; |
6297 | *dst = pixel; |
6298 | ++src; |
6299 | ++dst; |
6300 | } |
6301 | info->src += info->src_pitch; |
6302 | info->dst += info->dst_pitch; |
6303 | } |
6304 | } |
6305 | |
6306 | static void SDL_Blit_BGRA8888_BGR888_Modulate_Scale(SDL_BlitInfo *info) |
6307 | { |
6308 | const int flags = info->flags; |
6309 | const Uint32 modulateR = info->r; |
6310 | const Uint32 modulateG = info->g; |
6311 | const Uint32 modulateB = info->b; |
6312 | Uint32 pixel; |
6313 | Uint32 R, G, B; |
6314 | int srcy, srcx; |
6315 | Uint32 posy, posx; |
6316 | int incy, incx; |
6317 | |
6318 | incy = (info->src_h << 16) / info->dst_h; |
6319 | incx = (info->src_w << 16) / info->dst_w; |
6320 | posy = incy / 2; |
6321 | |
6322 | while (info->dst_h--) { |
6323 | Uint32 *src = 0; |
6324 | Uint32 *dst = (Uint32 *)info->dst; |
6325 | int n = info->dst_w; |
6326 | posx = incx / 2; |
6327 | |
6328 | srcy = posy >> 16; |
6329 | while (n--) { |
6330 | srcx = posx >> 16; |
6331 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
6332 | pixel = *src; |
6333 | B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); |
6334 | if (flags & SDL_COPY_MODULATE_COLOR) { |
6335 | R = (R * modulateR) / 255; |
6336 | G = (G * modulateG) / 255; |
6337 | B = (B * modulateB) / 255; |
6338 | } |
6339 | pixel = (B << 16) | (G << 8) | R; |
6340 | *dst = pixel; |
6341 | posx += incx; |
6342 | ++dst; |
6343 | } |
6344 | posy += incy; |
6345 | info->dst += info->dst_pitch; |
6346 | } |
6347 | } |
6348 | |
6349 | static void SDL_Blit_BGRA8888_BGR888_Modulate_Blend(SDL_BlitInfo *info) |
6350 | { |
6351 | const int flags = info->flags; |
6352 | const Uint32 modulateR = info->r; |
6353 | const Uint32 modulateG = info->g; |
6354 | const Uint32 modulateB = info->b; |
6355 | const Uint32 modulateA = info->a; |
6356 | Uint32 srcpixel; |
6357 | Uint32 srcR, srcG, srcB, srcA; |
6358 | Uint32 dstpixel; |
6359 | Uint32 dstR, dstG, dstB; |
6360 | |
6361 | while (info->dst_h--) { |
6362 | Uint32 *src = (Uint32 *)info->src; |
6363 | Uint32 *dst = (Uint32 *)info->dst; |
6364 | int n = info->dst_w; |
6365 | while (n--) { |
6366 | srcpixel = *src; |
6367 | srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; |
6368 | dstpixel = *dst; |
6369 | dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; |
6370 | if (flags & SDL_COPY_MODULATE_COLOR) { |
6371 | srcR = (srcR * modulateR) / 255; |
6372 | srcG = (srcG * modulateG) / 255; |
6373 | srcB = (srcB * modulateB) / 255; |
6374 | } |
6375 | if (flags & SDL_COPY_MODULATE_ALPHA) { |
6376 | srcA = (srcA * modulateA) / 255; |
6377 | } |
6378 | if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
6379 | /* This goes away if we ever use premultiplied alpha */ |
6380 | if (srcA < 255) { |
6381 | srcR = (srcR * srcA) / 255; |
6382 | srcG = (srcG * srcA) / 255; |
6383 | srcB = (srcB * srcA) / 255; |
6384 | } |
6385 | } |
6386 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
6387 | case SDL_COPY_BLEND: |
6388 | dstR = srcR + ((255 - srcA) * dstR) / 255; |
6389 | dstG = srcG + ((255 - srcA) * dstG) / 255; |
6390 | dstB = srcB + ((255 - srcA) * dstB) / 255; |
6391 | break; |
6392 | case SDL_COPY_ADD: |
6393 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
6394 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
6395 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
6396 | break; |
6397 | case SDL_COPY_MOD: |
6398 | dstR = (srcR * dstR) / 255; |
6399 | dstG = (srcG * dstG) / 255; |
6400 | dstB = (srcB * dstB) / 255; |
6401 | break; |
6402 | case SDL_COPY_MUL: |
6403 | dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255; |
6404 | dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255; |
6405 | dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255; |
6406 | break; |
6407 | } |
6408 | dstpixel = (dstB << 16) | (dstG << 8) | dstR; |
6409 | *dst = dstpixel; |
6410 | ++src; |
6411 | ++dst; |
6412 | } |
6413 | info->src += info->src_pitch; |
6414 | info->dst += info->dst_pitch; |
6415 | } |
6416 | } |
6417 | |
6418 | static void SDL_Blit_BGRA8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info) |
6419 | { |
6420 | const int flags = info->flags; |
6421 | const Uint32 modulateR = info->r; |
6422 | const Uint32 modulateG = info->g; |
6423 | const Uint32 modulateB = info->b; |
6424 | const Uint32 modulateA = info->a; |
6425 | Uint32 srcpixel; |
6426 | Uint32 srcR, srcG, srcB, srcA; |
6427 | Uint32 dstpixel; |
6428 | Uint32 dstR, dstG, dstB; |
6429 | int srcy, srcx; |
6430 | Uint32 posy, posx; |
6431 | int incy, incx; |
6432 | |
6433 | incy = (info->src_h << 16) / info->dst_h; |
6434 | incx = (info->src_w << 16) / info->dst_w; |
6435 | posy = incy / 2; |
6436 | |
6437 | while (info->dst_h--) { |
6438 | Uint32 *src = 0; |
6439 | Uint32 *dst = (Uint32 *)info->dst; |
6440 | int n = info->dst_w; |
6441 | posx = incx / 2; |
6442 | |
6443 | srcy = posy >> 16; |
6444 | while (n--) { |
6445 | srcx = posx >> 16; |
6446 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
6447 | srcpixel = *src; |
6448 | srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; |
6449 | dstpixel = *dst; |
6450 | dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; |
6451 | if (flags & SDL_COPY_MODULATE_COLOR) { |
6452 | srcR = (srcR * modulateR) / 255; |
6453 | srcG = (srcG * modulateG) / 255; |
6454 | srcB = (srcB * modulateB) / 255; |
6455 | } |
6456 | if (flags & SDL_COPY_MODULATE_ALPHA) { |
6457 | srcA = (srcA * modulateA) / 255; |
6458 | } |
6459 | if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
6460 | /* This goes away if we ever use premultiplied alpha */ |
6461 | if (srcA < 255) { |
6462 | srcR = (srcR * srcA) / 255; |
6463 | srcG = (srcG * srcA) / 255; |
6464 | srcB = (srcB * srcA) / 255; |
6465 | } |
6466 | } |
6467 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
6468 | case SDL_COPY_BLEND: |
6469 | dstR = srcR + ((255 - srcA) * dstR) / 255; |
6470 | dstG = srcG + ((255 - srcA) * dstG) / 255; |
6471 | dstB = srcB + ((255 - srcA) * dstB) / 255; |
6472 | break; |
6473 | case SDL_COPY_ADD: |
6474 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
6475 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
6476 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
6477 | break; |
6478 | case SDL_COPY_MOD: |
6479 | dstR = (srcR * dstR) / 255; |
6480 | dstG = (srcG * dstG) / 255; |
6481 | dstB = (srcB * dstB) / 255; |
6482 | break; |
6483 | case SDL_COPY_MUL: |
6484 | dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255; |
6485 | dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255; |
6486 | dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255; |
6487 | break; |
6488 | } |
6489 | dstpixel = (dstB << 16) | (dstG << 8) | dstR; |
6490 | *dst = dstpixel; |
6491 | posx += incx; |
6492 | ++dst; |
6493 | } |
6494 | posy += incy; |
6495 | info->dst += info->dst_pitch; |
6496 | } |
6497 | } |
6498 | |
6499 | static void SDL_Blit_BGRA8888_ARGB8888_Scale(SDL_BlitInfo *info) |
6500 | { |
6501 | Uint32 pixel; |
6502 | Uint32 R, G, B, A; |
6503 | int srcy, srcx; |
6504 | Uint32 posy, posx; |
6505 | int incy, incx; |
6506 | |
6507 | incy = (info->src_h << 16) / info->dst_h; |
6508 | incx = (info->src_w << 16) / info->dst_w; |
6509 | posy = incy / 2; |
6510 | |
6511 | while (info->dst_h--) { |
6512 | Uint32 *src = 0; |
6513 | Uint32 *dst = (Uint32 *)info->dst; |
6514 | int n = info->dst_w; |
6515 | posx = incx / 2; |
6516 | |
6517 | srcy = posy >> 16; |
6518 | while (n--) { |
6519 | srcx = posx >> 16; |
6520 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
6521 | pixel = *src; |
6522 | B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); A = (Uint8)pixel; |
6523 | pixel = (A << 24) | (R << 16) | (G << 8) | B; |
6524 | *dst = pixel; |
6525 | posx += incx; |
6526 | ++dst; |
6527 | } |
6528 | posy += incy; |
6529 | info->dst += info->dst_pitch; |
6530 | } |
6531 | } |
6532 | |
6533 | static void SDL_Blit_BGRA8888_ARGB8888_Blend(SDL_BlitInfo *info) |
6534 | { |
6535 | const int flags = info->flags; |
6536 | Uint32 srcpixel; |
6537 | Uint32 srcR, srcG, srcB, srcA; |
6538 | Uint32 dstpixel; |
6539 | Uint32 dstR, dstG, dstB, dstA; |
6540 | |
6541 | while (info->dst_h--) { |
6542 | Uint32 *src = (Uint32 *)info->src; |
6543 | Uint32 *dst = (Uint32 *)info->dst; |
6544 | int n = info->dst_w; |
6545 | while (n--) { |
6546 | srcpixel = *src; |
6547 | srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; |
6548 | dstpixel = *dst; |
6549 | dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24); |
6550 | if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
6551 | /* This goes away if we ever use premultiplied alpha */ |
6552 | if (srcA < 255) { |
6553 | srcR = (srcR * srcA) / 255; |
6554 | srcG = (srcG * srcA) / 255; |
6555 | srcB = (srcB * srcA) / 255; |
6556 | } |
6557 | } |
6558 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
6559 | case SDL_COPY_BLEND: |
6560 | dstR = srcR + ((255 - srcA) * dstR) / 255; |
6561 | dstG = srcG + ((255 - srcA) * dstG) / 255; |
6562 | dstB = srcB + ((255 - srcA) * dstB) / 255; |
6563 | dstA = srcA + ((255 - srcA) * dstA) / 255; |
6564 | break; |
6565 | case SDL_COPY_ADD: |
6566 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
6567 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
6568 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
6569 | break; |
6570 | case SDL_COPY_MOD: |
6571 | dstR = (srcR * dstR) / 255; |
6572 | dstG = (srcG * dstG) / 255; |
6573 | dstB = (srcB * dstB) / 255; |
6574 | break; |
6575 | case SDL_COPY_MUL: |
6576 | dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255; |
6577 | dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255; |
6578 | dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255; |
6579 | dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) dstA = 255; |
6580 | break; |
6581 | } |
6582 | dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB; |
6583 | *dst = dstpixel; |
6584 | ++src; |
6585 | ++dst; |
6586 | } |
6587 | info->src += info->src_pitch; |
6588 | info->dst += info->dst_pitch; |
6589 | } |
6590 | } |
6591 | |
6592 | static void SDL_Blit_BGRA8888_ARGB8888_Blend_Scale(SDL_BlitInfo *info) |
6593 | { |
6594 | const int flags = info->flags; |
6595 | Uint32 srcpixel; |
6596 | Uint32 srcR, srcG, srcB, srcA; |
6597 | Uint32 dstpixel; |
6598 | Uint32 dstR, dstG, dstB, dstA; |
6599 | int srcy, srcx; |
6600 | Uint32 posy, posx; |
6601 | int incy, incx; |
6602 | |
6603 | incy = (info->src_h << 16) / info->dst_h; |
6604 | incx = (info->src_w << 16) / info->dst_w; |
6605 | posy = incy / 2; |
6606 | |
6607 | while (info->dst_h--) { |
6608 | Uint32 *src = 0; |
6609 | Uint32 *dst = (Uint32 *)info->dst; |
6610 | int n = info->dst_w; |
6611 | posx = incx / 2; |
6612 | |
6613 | srcy = posy >> 16; |
6614 | while (n--) { |
6615 | srcx = posx >> 16; |
6616 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
6617 | srcpixel = *src; |
6618 | srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; |
6619 | dstpixel = *dst; |
6620 | dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24); |
6621 | if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
6622 | /* This goes away if we ever use premultiplied alpha */ |
6623 | if (srcA < 255) { |
6624 | srcR = (srcR * srcA) / 255; |
6625 | srcG = (srcG * srcA) / 255; |
6626 | srcB = (srcB * srcA) / 255; |
6627 | } |
6628 | } |
6629 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
6630 | case SDL_COPY_BLEND: |
6631 | dstR = srcR + ((255 - srcA) * dstR) / 255; |
6632 | dstG = srcG + ((255 - srcA) * dstG) / 255; |
6633 | dstB = srcB + ((255 - srcA) * dstB) / 255; |
6634 | dstA = srcA + ((255 - srcA) * dstA) / 255; |
6635 | break; |
6636 | case SDL_COPY_ADD: |
6637 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
6638 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
6639 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
6640 | break; |
6641 | case SDL_COPY_MOD: |
6642 | dstR = (srcR * dstR) / 255; |
6643 | dstG = (srcG * dstG) / 255; |
6644 | dstB = (srcB * dstB) / 255; |
6645 | break; |
6646 | case SDL_COPY_MUL: |
6647 | dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255; |
6648 | dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255; |
6649 | dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255; |
6650 | dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) dstA = 255; |
6651 | break; |
6652 | } |
6653 | dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB; |
6654 | *dst = dstpixel; |
6655 | posx += incx; |
6656 | ++dst; |
6657 | } |
6658 | posy += incy; |
6659 | info->dst += info->dst_pitch; |
6660 | } |
6661 | } |
6662 | |
6663 | static void SDL_Blit_BGRA8888_ARGB8888_Modulate(SDL_BlitInfo *info) |
6664 | { |
6665 | const int flags = info->flags; |
6666 | const Uint32 modulateR = info->r; |
6667 | const Uint32 modulateG = info->g; |
6668 | const Uint32 modulateB = info->b; |
6669 | const Uint32 modulateA = info->a; |
6670 | Uint32 pixel; |
6671 | Uint32 R, G, B, A; |
6672 | |
6673 | while (info->dst_h--) { |
6674 | Uint32 *src = (Uint32 *)info->src; |
6675 | Uint32 *dst = (Uint32 *)info->dst; |
6676 | int n = info->dst_w; |
6677 | while (n--) { |
6678 | pixel = *src; |
6679 | B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); A = (Uint8)pixel; |
6680 | if (flags & SDL_COPY_MODULATE_COLOR) { |
6681 | R = (R * modulateR) / 255; |
6682 | G = (G * modulateG) / 255; |
6683 | B = (B * modulateB) / 255; |
6684 | } |
6685 | if (flags & SDL_COPY_MODULATE_ALPHA) { |
6686 | A = (A * modulateA) / 255; |
6687 | } |
6688 | pixel = (A << 24) | (R << 16) | (G << 8) | B; |
6689 | *dst = pixel; |
6690 | ++src; |
6691 | ++dst; |
6692 | } |
6693 | info->src += info->src_pitch; |
6694 | info->dst += info->dst_pitch; |
6695 | } |
6696 | } |
6697 | |
6698 | static void SDL_Blit_BGRA8888_ARGB8888_Modulate_Scale(SDL_BlitInfo *info) |
6699 | { |
6700 | const int flags = info->flags; |
6701 | const Uint32 modulateR = info->r; |
6702 | const Uint32 modulateG = info->g; |
6703 | const Uint32 modulateB = info->b; |
6704 | const Uint32 modulateA = info->a; |
6705 | Uint32 pixel; |
6706 | Uint32 R, G, B, A; |
6707 | int srcy, srcx; |
6708 | Uint32 posy, posx; |
6709 | int incy, incx; |
6710 | |
6711 | incy = (info->src_h << 16) / info->dst_h; |
6712 | incx = (info->src_w << 16) / info->dst_w; |
6713 | posy = incy / 2; |
6714 | |
6715 | while (info->dst_h--) { |
6716 | Uint32 *src = 0; |
6717 | Uint32 *dst = (Uint32 *)info->dst; |
6718 | int n = info->dst_w; |
6719 | posx = incx / 2; |
6720 | |
6721 | srcy = posy >> 16; |
6722 | while (n--) { |
6723 | srcx = posx >> 16; |
6724 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
6725 | pixel = *src; |
6726 | B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); A = (Uint8)pixel; |
6727 | if (flags & SDL_COPY_MODULATE_COLOR) { |
6728 | R = (R * modulateR) / 255; |
6729 | G = (G * modulateG) / 255; |
6730 | B = (B * modulateB) / 255; |
6731 | } |
6732 | if (flags & SDL_COPY_MODULATE_ALPHA) { |
6733 | A = (A * modulateA) / 255; |
6734 | } |
6735 | pixel = (A << 24) | (R << 16) | (G << 8) | B; |
6736 | *dst = pixel; |
6737 | posx += incx; |
6738 | ++dst; |
6739 | } |
6740 | posy += incy; |
6741 | info->dst += info->dst_pitch; |
6742 | } |
6743 | } |
6744 | |
6745 | static void SDL_Blit_BGRA8888_ARGB8888_Modulate_Blend(SDL_BlitInfo *info) |
6746 | { |
6747 | const int flags = info->flags; |
6748 | const Uint32 modulateR = info->r; |
6749 | const Uint32 modulateG = info->g; |
6750 | const Uint32 modulateB = info->b; |
6751 | const Uint32 modulateA = info->a; |
6752 | Uint32 srcpixel; |
6753 | Uint32 srcR, srcG, srcB, srcA; |
6754 | Uint32 dstpixel; |
6755 | Uint32 dstR, dstG, dstB, dstA; |
6756 | |
6757 | while (info->dst_h--) { |
6758 | Uint32 *src = (Uint32 *)info->src; |
6759 | Uint32 *dst = (Uint32 *)info->dst; |
6760 | int n = info->dst_w; |
6761 | while (n--) { |
6762 | srcpixel = *src; |
6763 | srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; |
6764 | dstpixel = *dst; |
6765 | dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24); |
6766 | if (flags & SDL_COPY_MODULATE_COLOR) { |
6767 | srcR = (srcR * modulateR) / 255; |
6768 | srcG = (srcG * modulateG) / 255; |
6769 | srcB = (srcB * modulateB) / 255; |
6770 | } |
6771 | if (flags & SDL_COPY_MODULATE_ALPHA) { |
6772 | srcA = (srcA * modulateA) / 255; |
6773 | } |
6774 | if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
6775 | /* This goes away if we ever use premultiplied alpha */ |
6776 | if (srcA < 255) { |
6777 | srcR = (srcR * srcA) / 255; |
6778 | srcG = (srcG * srcA) / 255; |
6779 | srcB = (srcB * srcA) / 255; |
6780 | } |
6781 | } |
6782 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
6783 | case SDL_COPY_BLEND: |
6784 | dstR = srcR + ((255 - srcA) * dstR) / 255; |
6785 | dstG = srcG + ((255 - srcA) * dstG) / 255; |
6786 | dstB = srcB + ((255 - srcA) * dstB) / 255; |
6787 | dstA = srcA + ((255 - srcA) * dstA) / 255; |
6788 | break; |
6789 | case SDL_COPY_ADD: |
6790 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
6791 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
6792 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
6793 | break; |
6794 | case SDL_COPY_MOD: |
6795 | dstR = (srcR * dstR) / 255; |
6796 | dstG = (srcG * dstG) / 255; |
6797 | dstB = (srcB * dstB) / 255; |
6798 | break; |
6799 | case SDL_COPY_MUL: |
6800 | dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255; |
6801 | dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255; |
6802 | dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255; |
6803 | dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) dstA = 255; |
6804 | break; |
6805 | } |
6806 | dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB; |
6807 | *dst = dstpixel; |
6808 | ++src; |
6809 | ++dst; |
6810 | } |
6811 | info->src += info->src_pitch; |
6812 | info->dst += info->dst_pitch; |
6813 | } |
6814 | } |
6815 | |
6816 | static void SDL_Blit_BGRA8888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info) |
6817 | { |
6818 | const int flags = info->flags; |
6819 | const Uint32 modulateR = info->r; |
6820 | const Uint32 modulateG = info->g; |
6821 | const Uint32 modulateB = info->b; |
6822 | const Uint32 modulateA = info->a; |
6823 | Uint32 srcpixel; |
6824 | Uint32 srcR, srcG, srcB, srcA; |
6825 | Uint32 dstpixel; |
6826 | Uint32 dstR, dstG, dstB, dstA; |
6827 | int srcy, srcx; |
6828 | Uint32 posy, posx; |
6829 | int incy, incx; |
6830 | |
6831 | incy = (info->src_h << 16) / info->dst_h; |
6832 | incx = (info->src_w << 16) / info->dst_w; |
6833 | posy = incy / 2; |
6834 | |
6835 | while (info->dst_h--) { |
6836 | Uint32 *src = 0; |
6837 | Uint32 *dst = (Uint32 *)info->dst; |
6838 | int n = info->dst_w; |
6839 | posx = incx / 2; |
6840 | |
6841 | srcy = posy >> 16; |
6842 | while (n--) { |
6843 | srcx = posx >> 16; |
6844 | src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); |
6845 | srcpixel = *src; |
6846 | srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; |
6847 | dstpixel = *dst; |
6848 | dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24); |
6849 | if (flags & SDL_COPY_MODULATE_COLOR) { |
6850 | srcR = (srcR * modulateR) / 255; |
6851 | srcG = (srcG * modulateG) / 255; |
6852 | srcB = (srcB * modulateB) / 255; |
6853 | } |
6854 | if (flags & SDL_COPY_MODULATE_ALPHA) { |
6855 | srcA = (srcA * modulateA) / 255; |
6856 | } |
6857 | if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
6858 | /* This goes away if we ever use premultiplied alpha */ |
6859 | if (srcA < 255) { |
6860 | srcR = (srcR * srcA) / 255; |
6861 | srcG = (srcG * srcA) / 255; |
6862 | srcB = (srcB * srcA) / 255; |
6863 | } |
6864 | } |
6865 | switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD|SDL_COPY_MUL)) { |
6866 | case SDL_COPY_BLEND: |
6867 | dstR = srcR + ((255 - srcA) * dstR) / 255; |
6868 | dstG = srcG + ((255 - srcA) * dstG) / 255; |
6869 | dstB = srcB + ((255 - srcA) * dstB) / 255; |
6870 | dstA = srcA + ((255 - srcA) * dstA) / 255; |
6871 | break; |
6872 | case SDL_COPY_ADD: |
6873 | dstR = srcR + dstR; if (dstR > 255) dstR = 255; |
6874 | dstG = srcG + dstG; if (dstG > 255) dstG = 255; |
6875 | dstB = srcB + dstB; if (dstB > 255) dstB = 255; |
6876 | break; |
6877 | case SDL_COPY_MOD: |
6878 | dstR = (srcR * dstR) / 255; |
6879 | dstG = (srcG * dstG) / 255; |
6880 | dstB = (srcB * dstB) / 255; |
6881 | break; |
6882 | case SDL_COPY_MUL: |
6883 | dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255; |
6884 | dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255; |
6885 | dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255; |
6886 | dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) dstA = 255; |
6887 | break; |
6888 | } |
6889 | dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB; |
6890 | *dst = dstpixel; |
6891 | posx += incx; |
6892 | ++dst; |
6893 | } |
6894 | posy += incy; |
6895 | info->dst += info->dst_pitch; |
6896 | } |
6897 | } |
6898 | |
6899 | SDL_BlitFuncEntry SDL_GeneratedBlitFuncTable[] = { |
6900 | { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_RGB888_Scale }, |
6901 | { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_RGB888_RGB888_Blend }, |
6902 | { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_RGB888_Blend_Scale }, |
6903 | { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_RGB888_RGB888_Modulate }, |
6904 | { 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 }, |
6905 | { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_RGB888_RGB888_Modulate_Blend }, |
6906 | { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_RGB888_Modulate_Blend_Scale }, |
6907 | { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_BGR888_Scale }, |
6908 | { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_RGB888_BGR888_Blend }, |
6909 | { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_BGR888_Blend_Scale }, |
6910 | { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_RGB888_BGR888_Modulate }, |
6911 | { 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 }, |
6912 | { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_RGB888_BGR888_Modulate_Blend }, |
6913 | { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_BGR888_Modulate_Blend_Scale }, |
6914 | { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_ARGB8888_Scale }, |
6915 | { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_RGB888_ARGB8888_Blend }, |
6916 | { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_ARGB8888_Blend_Scale }, |
6917 | { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_RGB888_ARGB8888_Modulate }, |
6918 | { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_ARGB8888_Modulate_Scale }, |
6919 | { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_RGB888_ARGB8888_Modulate_Blend }, |
6920 | { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_ARGB8888_Modulate_Blend_Scale }, |
6921 | { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Scale }, |
6922 | { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Blend }, |
6923 | { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Blend_Scale }, |
6924 | { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Modulate }, |
6925 | { 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 }, |
6926 | { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Modulate_Blend }, |
6927 | { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Modulate_Blend_Scale }, |
6928 | { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_BGR888_Scale }, |
6929 | { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_BGR888_BGR888_Blend }, |
6930 | { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_BGR888_Blend_Scale }, |
6931 | { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_BGR888_BGR888_Modulate }, |
6932 | { 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 }, |
6933 | { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_BGR888_BGR888_Modulate_Blend }, |
6934 | { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_BGR888_Modulate_Blend_Scale }, |
6935 | { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_ARGB8888_Scale }, |
6936 | { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_BGR888_ARGB8888_Blend }, |
6937 | { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_ARGB8888_Blend_Scale }, |
6938 | { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_BGR888_ARGB8888_Modulate }, |
6939 | { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_ARGB8888_Modulate_Scale }, |
6940 | { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_BGR888_ARGB8888_Modulate_Blend }, |
6941 | { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_ARGB8888_Modulate_Blend_Scale }, |
6942 | { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Scale }, |
6943 | { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Blend }, |
6944 | { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Blend_Scale }, |
6945 | { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Modulate }, |
6946 | { 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 }, |
6947 | { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Modulate_Blend }, |
6948 | { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Modulate_Blend_Scale }, |
6949 | { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_BGR888_Scale }, |
6950 | { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_ARGB8888_BGR888_Blend }, |
6951 | { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_BGR888_Blend_Scale }, |
6952 | { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_ARGB8888_BGR888_Modulate }, |
6953 | { 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 }, |
6954 | { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_ARGB8888_BGR888_Modulate_Blend }, |
6955 | { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_BGR888_Modulate_Blend_Scale }, |
6956 | { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_ARGB8888_Scale }, |
6957 | { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_ARGB8888_ARGB8888_Blend }, |
6958 | { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_ARGB8888_Blend_Scale }, |
6959 | { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_ARGB8888_ARGB8888_Modulate }, |
6960 | { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_ARGB8888_Modulate_Scale }, |
6961 | { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_ARGB8888_ARGB8888_Modulate_Blend }, |
6962 | { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_ARGB8888_Modulate_Blend_Scale }, |
6963 | { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Scale }, |
6964 | { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Blend }, |
6965 | { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Blend_Scale }, |
6966 | { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Modulate }, |
6967 | { 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 }, |
6968 | { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Modulate_Blend }, |
6969 | { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Modulate_Blend_Scale }, |
6970 | { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_BGR888_Scale }, |
6971 | { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_RGBA8888_BGR888_Blend }, |
6972 | { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_BGR888_Blend_Scale }, |
6973 | { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_RGBA8888_BGR888_Modulate }, |
6974 | { 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 }, |
6975 | { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_RGBA8888_BGR888_Modulate_Blend }, |
6976 | { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_BGR888_Modulate_Blend_Scale }, |
6977 | { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_ARGB8888_Scale }, |
6978 | { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_RGBA8888_ARGB8888_Blend }, |
6979 | { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_ARGB8888_Blend_Scale }, |
6980 | { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_RGBA8888_ARGB8888_Modulate }, |
6981 | { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_ARGB8888_Modulate_Scale }, |
6982 | { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_RGBA8888_ARGB8888_Modulate_Blend }, |
6983 | { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_ARGB8888_Modulate_Blend_Scale }, |
6984 | { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Scale }, |
6985 | { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Blend }, |
6986 | { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Blend_Scale }, |
6987 | { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Modulate }, |
6988 | { 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 }, |
6989 | { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Modulate_Blend }, |
6990 | { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Modulate_Blend_Scale }, |
6991 | { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_BGR888_Scale }, |
6992 | { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_ABGR8888_BGR888_Blend }, |
6993 | { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_BGR888_Blend_Scale }, |
6994 | { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_ABGR8888_BGR888_Modulate }, |
6995 | { 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 }, |
6996 | { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_ABGR8888_BGR888_Modulate_Blend }, |
6997 | { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_BGR888_Modulate_Blend_Scale }, |
6998 | { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_ARGB8888_Scale }, |
6999 | { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_ABGR8888_ARGB8888_Blend }, |
7000 | { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_ARGB8888_Blend_Scale }, |
7001 | { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_ABGR8888_ARGB8888_Modulate }, |
7002 | { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_ARGB8888_Modulate_Scale }, |
7003 | { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_ABGR8888_ARGB8888_Modulate_Blend }, |
7004 | { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_ARGB8888_Modulate_Blend_Scale }, |
7005 | { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Scale }, |
7006 | { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Blend }, |
7007 | { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Blend_Scale }, |
7008 | { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Modulate }, |
7009 | { 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 }, |
7010 | { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Modulate_Blend }, |
7011 | { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Modulate_Blend_Scale }, |
7012 | { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_BGR888_Scale }, |
7013 | { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_BGRA8888_BGR888_Blend }, |
7014 | { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_BGR888_Blend_Scale }, |
7015 | { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_BGRA8888_BGR888_Modulate }, |
7016 | { 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 }, |
7017 | { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_BGRA8888_BGR888_Modulate_Blend }, |
7018 | { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_BGR888_Modulate_Blend_Scale }, |
7019 | { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_ARGB8888_Scale }, |
7020 | { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_BGRA8888_ARGB8888_Blend }, |
7021 | { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_ARGB8888_Blend_Scale }, |
7022 | { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_BGRA8888_ARGB8888_Modulate }, |
7023 | { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_ARGB8888_Modulate_Scale }, |
7024 | { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_BGRA8888_ARGB8888_Modulate_Blend }, |
7025 | { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_ARGB8888_Modulate_Blend_Scale }, |
7026 | { 0, 0, 0, 0, NULL } |
7027 | }; |
7028 | |
7029 | /* *INDENT-ON* */ |
7030 | |
7031 | #endif /* SDL_HAVE_BLIT_AUTO */ |
7032 | |
7033 | /* vi: set ts=4 sw=4 expandtab: */ |
7034 | |