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