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