Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Latest commit

 

History

History
7492 lines (7159 loc) · 271 KB

SDL_blit_auto.c

File metadata and controls

7492 lines (7159 loc) · 271 KB
 
1
2
3
/* DO NOT EDIT! This file is generated by sdlgenblit.pl */
/*
SDL - Simple DirectMedia Layer
Feb 1, 2011
Feb 1, 2011
4
Copyright (C) 1997-2011 Sam Lantinga
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
*/
#include "SDL_config.h"
/* *INDENT-OFF* */
#include "SDL_video.h"
Aug 17, 2007
Aug 17, 2007
28
29
30
#include "SDL_blit.h"
#include "SDL_blit_auto.h"
Aug 17, 2007
Aug 17, 2007
31
static void SDL_Blit_RGB888_RGB888_Scale(SDL_BlitInfo *info)
32
33
34
35
36
37
38
{
int srcy, srcx;
int posy, posx;
int incy, incx;
srcy = 0;
posy = 0;
Aug 17, 2007
Aug 17, 2007
39
40
incy = (info->src_h << 16) / info->dst_h;
incx = (info->src_w << 16) / info->dst_w;
Aug 17, 2007
Aug 17, 2007
42
while (info->dst_h--) {
Mar 7, 2011
Mar 7, 2011
43
Uint32 *src = 0;
Aug 17, 2007
Aug 17, 2007
44
45
Uint32 *dst = (Uint32 *)info->dst;
int n = info->dst_w;
46
47
48
49
50
51
52
53
54
55
56
57
srcx = -1;
posx = 0x10000L;
while (posy >= 0x10000L) {
++srcy;
posy -= 0x10000L;
}
while (n--) {
if (posx >= 0x10000L) {
while (posx >= 0x10000L) {
++srcx;
posx -= 0x10000L;
}
Aug 17, 2007
Aug 17, 2007
58
src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
59
60
61
62
63
64
}
*dst = *src;
posx += incx;
++dst;
}
posy += incy;
Aug 17, 2007
Aug 17, 2007
65
info->dst += info->dst_pitch;
66
67
68
}
}
Aug 17, 2007
Aug 17, 2007
69
static void SDL_Blit_RGB888_RGB888_Blend(SDL_BlitInfo *info)
Aug 17, 2007
Aug 17, 2007
71
const int flags = info->flags;
72
73
74
75
76
Uint32 srcpixel;
Uint32 srcR, srcG, srcB, srcA;
Uint32 dstpixel;
Uint32 dstR, dstG, dstB, dstA;
Aug 17, 2007
Aug 17, 2007
77
78
79
80
while (info->dst_h--) {
Uint32 *src = (Uint32 *)info->src;
Uint32 *dst = (Uint32 *)info->dst;
int n = info->dst_w;
81
82
83
84
85
while (n--) {
srcpixel = *src;
srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF;
dstpixel = *dst;
dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
Aug 17, 2007
Aug 17, 2007
86
if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
87
/* This goes away if we ever use premultiplied alpha */
Aug 28, 2006
Aug 28, 2006
88
89
90
91
92
if (srcA < 255) {
srcR = (srcR * srcA) / 255;
srcG = (srcG * srcA) / 255;
srcB = (srcB * srcA) / 255;
}
Feb 5, 2011
Feb 5, 2011
94
switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
Aug 17, 2007
Aug 17, 2007
95
case SDL_COPY_BLEND:
96
97
98
99
dstR = srcR + ((255 - srcA) * dstR) / 255;
dstG = srcG + ((255 - srcA) * dstG) / 255;
dstB = srcB + ((255 - srcA) * dstB) / 255;
break;
Aug 17, 2007
Aug 17, 2007
100
case SDL_COPY_ADD:
101
102
103
104
dstR = srcR + dstR; if (dstR > 255) dstR = 255;
dstG = srcG + dstG; if (dstG > 255) dstG = 255;
dstB = srcB + dstB; if (dstB > 255) dstB = 255;
break;
Feb 5, 2011
Feb 5, 2011
105
106
107
108
109
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
dstG = (srcG * dstG) / 255;
dstB = (srcB * dstB) / 255;
break;
110
111
112
113
114
115
}
dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
*dst = dstpixel;
++src;
++dst;
}
Aug 17, 2007
Aug 17, 2007
116
117
info->src += info->src_pitch;
info->dst += info->dst_pitch;
118
119
120
}
}
Aug 17, 2007
Aug 17, 2007
121
static void SDL_Blit_RGB888_RGB888_Blend_Scale(SDL_BlitInfo *info)
Aug 17, 2007
Aug 17, 2007
123
const int flags = info->flags;
124
125
126
127
128
129
130
131
132
133
Uint32 srcpixel;
Uint32 srcR, srcG, srcB, srcA;
Uint32 dstpixel;
Uint32 dstR, dstG, dstB, dstA;
int srcy, srcx;
int posy, posx;
int incy, incx;
srcy = 0;
posy = 0;
Aug 17, 2007
Aug 17, 2007
134
135
incy = (info->src_h << 16) / info->dst_h;
incx = (info->src_w << 16) / info->dst_w;
Aug 17, 2007
Aug 17, 2007
137
while (info->dst_h--) {
Mar 7, 2011
Mar 7, 2011
138
Uint32 *src = 0;
Aug 17, 2007
Aug 17, 2007
139
140
Uint32 *dst = (Uint32 *)info->dst;
int n = info->dst_w;
141
142
143
144
145
146
147
148
149
150
151
152
srcx = -1;
posx = 0x10000L;
while (posy >= 0x10000L) {
++srcy;
posy -= 0x10000L;
}
while (n--) {
if (posx >= 0x10000L) {
while (posx >= 0x10000L) {
++srcx;
posx -= 0x10000L;
}
Aug 17, 2007
Aug 17, 2007
153
src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
154
155
156
157
158
}
srcpixel = *src;
srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF;
dstpixel = *dst;
dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
Aug 17, 2007
Aug 17, 2007
159
if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
160
/* This goes away if we ever use premultiplied alpha */
Aug 28, 2006
Aug 28, 2006
161
162
163
164
165
if (srcA < 255) {
srcR = (srcR * srcA) / 255;
srcG = (srcG * srcA) / 255;
srcB = (srcB * srcA) / 255;
}
Feb 5, 2011
Feb 5, 2011
167
switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
Aug 17, 2007
Aug 17, 2007
168
case SDL_COPY_BLEND:
169
170
171
172
dstR = srcR + ((255 - srcA) * dstR) / 255;
dstG = srcG + ((255 - srcA) * dstG) / 255;
dstB = srcB + ((255 - srcA) * dstB) / 255;
break;
Aug 17, 2007
Aug 17, 2007
173
case SDL_COPY_ADD:
174
175
176
177
dstR = srcR + dstR; if (dstR > 255) dstR = 255;
dstG = srcG + dstG; if (dstG > 255) dstG = 255;
dstB = srcB + dstB; if (dstB > 255) dstB = 255;
break;
Feb 5, 2011
Feb 5, 2011
178
179
180
181
182
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
dstG = (srcG * dstG) / 255;
dstB = (srcB * dstB) / 255;
break;
183
184
185
186
187
188
189
}
dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
*dst = dstpixel;
posx += incx;
++dst;
}
posy += incy;
Aug 17, 2007
Aug 17, 2007
190
info->dst += info->dst_pitch;
191
192
193
}
}
Aug 17, 2007
Aug 17, 2007
194
static void SDL_Blit_RGB888_RGB888_Modulate(SDL_BlitInfo *info)
Aug 17, 2007
Aug 17, 2007
196
197
198
199
200
const int flags = info->flags;
const Uint32 modulateR = info->r;
const Uint32 modulateG = info->g;
const Uint32 modulateB = info->b;
const Uint32 modulateA = info->a;
201
202
203
Uint32 pixel;
Uint32 R, G, B, A;
Aug 17, 2007
Aug 17, 2007
204
205
206
207
while (info->dst_h--) {
Uint32 *src = (Uint32 *)info->src;
Uint32 *dst = (Uint32 *)info->dst;
int n = info->dst_w;
208
209
210
while (n--) {
pixel = *src;
R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; A = 0xFF;
Aug 17, 2007
Aug 17, 2007
211
if (flags & SDL_COPY_MODULATE_COLOR) {
212
213
214
215
R = (R * modulateR) / 255;
G = (G * modulateG) / 255;
B = (B * modulateB) / 255;
}
Aug 17, 2007
Aug 17, 2007
216
if (flags & SDL_COPY_MODULATE_ALPHA) {
Aug 28, 2006
Aug 28, 2006
217
218
A = (A * modulateA) / 255;
}
219
220
221
222
223
pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
*dst = pixel;
++src;
++dst;
}
Aug 17, 2007
Aug 17, 2007
224
225
info->src += info->src_pitch;
info->dst += info->dst_pitch;
226
227
228
}
}
Aug 17, 2007
Aug 17, 2007
229
static void SDL_Blit_RGB888_RGB888_Modulate_Scale(SDL_BlitInfo *info)
Aug 17, 2007
Aug 17, 2007
231
232
233
234
235
const int flags = info->flags;
const Uint32 modulateR = info->r;
const Uint32 modulateG = info->g;
const Uint32 modulateB = info->b;
const Uint32 modulateA = info->a;
236
237
238
239
240
241
242
243
Uint32 pixel;
Uint32 R, G, B, A;
int srcy, srcx;
int posy, posx;
int incy, incx;
srcy = 0;
posy = 0;
Aug 17, 2007
Aug 17, 2007
244
245
incy = (info->src_h << 16) / info->dst_h;
incx = (info->src_w << 16) / info->dst_w;
Aug 17, 2007
Aug 17, 2007
247
while (info->dst_h--) {
Mar 7, 2011
Mar 7, 2011
248
Uint32 *src = 0;
Aug 17, 2007
Aug 17, 2007
249
250
Uint32 *dst = (Uint32 *)info->dst;
int n = info->dst_w;
251
252
253
254
255
256
257
258
259
260
261
262
srcx = -1;
posx = 0x10000L;
while (posy >= 0x10000L) {
++srcy;
posy -= 0x10000L;
}
while (n--) {
if (posx >= 0x10000L) {
while (posx >= 0x10000L) {
++srcx;
posx -= 0x10000L;
}
Aug 17, 2007
Aug 17, 2007
263
src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
264
265
266
}
pixel = *src;
R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; A = 0xFF;
Aug 17, 2007
Aug 17, 2007
267
if (flags & SDL_COPY_MODULATE_COLOR) {
268
269
270
271
R = (R * modulateR) / 255;
G = (G * modulateG) / 255;
B = (B * modulateB) / 255;
}
Aug 17, 2007
Aug 17, 2007
272
if (flags & SDL_COPY_MODULATE_ALPHA) {
Aug 28, 2006
Aug 28, 2006
273
274
A = (A * modulateA) / 255;
}
275
276
277
278
279
280
pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
*dst = pixel;
posx += incx;
++dst;
}
posy += incy;
Aug 17, 2007
Aug 17, 2007
281
info->dst += info->dst_pitch;
282
283
284
}
}
Aug 17, 2007
Aug 17, 2007
285
static void SDL_Blit_RGB888_RGB888_Modulate_Blend(SDL_BlitInfo *info)
Aug 17, 2007
Aug 17, 2007
287
288
289
290
291
const int flags = info->flags;
const Uint32 modulateR = info->r;
const Uint32 modulateG = info->g;
const Uint32 modulateB = info->b;
const Uint32 modulateA = info->a;
292
293
294
295
296
Uint32 srcpixel;
Uint32 srcR, srcG, srcB, srcA;
Uint32 dstpixel;
Uint32 dstR, dstG, dstB, dstA;
Aug 17, 2007
Aug 17, 2007
297
298
299
300
while (info->dst_h--) {
Uint32 *src = (Uint32 *)info->src;
Uint32 *dst = (Uint32 *)info->dst;
int n = info->dst_w;
301
302
303
304
305
while (n--) {
srcpixel = *src;
srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF;
dstpixel = *dst;
dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
Aug 17, 2007
Aug 17, 2007
306
if (flags & SDL_COPY_MODULATE_COLOR) {
307
308
309
310
srcR = (srcR * modulateR) / 255;
srcG = (srcG * modulateG) / 255;
srcB = (srcB * modulateB) / 255;
}
Aug 17, 2007
Aug 17, 2007
311
if (flags & SDL_COPY_MODULATE_ALPHA) {
312
313
srcA = (srcA * modulateA) / 255;
}
Aug 17, 2007
Aug 17, 2007
314
if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
315
/* This goes away if we ever use premultiplied alpha */
Aug 28, 2006
Aug 28, 2006
316
317
318
319
320
if (srcA < 255) {
srcR = (srcR * srcA) / 255;
srcG = (srcG * srcA) / 255;
srcB = (srcB * srcA) / 255;
}
Feb 5, 2011
Feb 5, 2011
322
switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
Aug 17, 2007
Aug 17, 2007
323
case SDL_COPY_BLEND:
324
325
326
327
dstR = srcR + ((255 - srcA) * dstR) / 255;
dstG = srcG + ((255 - srcA) * dstG) / 255;
dstB = srcB + ((255 - srcA) * dstB) / 255;
break;
Aug 17, 2007
Aug 17, 2007
328
case SDL_COPY_ADD:
329
330
331
332
dstR = srcR + dstR; if (dstR > 255) dstR = 255;
dstG = srcG + dstG; if (dstG > 255) dstG = 255;
dstB = srcB + dstB; if (dstB > 255) dstB = 255;
break;
Feb 5, 2011
Feb 5, 2011
333
334
335
336
337
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
dstG = (srcG * dstG) / 255;
dstB = (srcB * dstB) / 255;
break;
338
339
340
341
342
343
}
dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
*dst = dstpixel;
++src;
++dst;
}
Aug 17, 2007
Aug 17, 2007
344
345
info->src += info->src_pitch;
info->dst += info->dst_pitch;
346
347
348
}
}
Aug 17, 2007
Aug 17, 2007
349
static void SDL_Blit_RGB888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info)
Aug 17, 2007
Aug 17, 2007
351
352
353
354
355
const int flags = info->flags;
const Uint32 modulateR = info->r;
const Uint32 modulateG = info->g;
const Uint32 modulateB = info->b;
const Uint32 modulateA = info->a;
356
357
358
359
360
361
362
363
364
365
Uint32 srcpixel;
Uint32 srcR, srcG, srcB, srcA;
Uint32 dstpixel;
Uint32 dstR, dstG, dstB, dstA;
int srcy, srcx;
int posy, posx;
int incy, incx;
srcy = 0;
posy = 0;
Aug 17, 2007
Aug 17, 2007
366
367
incy = (info->src_h << 16) / info->dst_h;
incx = (info->src_w << 16) / info->dst_w;
Aug 17, 2007
Aug 17, 2007
369
while (info->dst_h--) {
Mar 7, 2011
Mar 7, 2011
370
Uint32 *src = 0;
Aug 17, 2007
Aug 17, 2007
371
372
Uint32 *dst = (Uint32 *)info->dst;
int n = info->dst_w;
373
374
375
376
377
378
379
380
381
382
383
384
srcx = -1;
posx = 0x10000L;
while (posy >= 0x10000L) {
++srcy;
posy -= 0x10000L;
}
while (n--) {
if (posx >= 0x10000L) {
while (posx >= 0x10000L) {
++srcx;
posx -= 0x10000L;
}
Aug 17, 2007
Aug 17, 2007
385
src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
386
387
388
389
390
}
srcpixel = *src;
srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF;
dstpixel = *dst;
dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
Aug 17, 2007
Aug 17, 2007
391
if (flags & SDL_COPY_MODULATE_COLOR) {
392
393
394
395
srcR = (srcR * modulateR) / 255;
srcG = (srcG * modulateG) / 255;
srcB = (srcB * modulateB) / 255;
}
Aug 17, 2007
Aug 17, 2007
396
if (flags & SDL_COPY_MODULATE_ALPHA) {
397
398
srcA = (srcA * modulateA) / 255;
}
Aug 17, 2007
Aug 17, 2007
399
if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
400
/* This goes away if we ever use premultiplied alpha */
Aug 28, 2006
Aug 28, 2006
401
402
403
404
405
if (srcA < 255) {
srcR = (srcR * srcA) / 255;
srcG = (srcG * srcA) / 255;
srcB = (srcB * srcA) / 255;
}
Feb 5, 2011
Feb 5, 2011
407
switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
Aug 17, 2007
Aug 17, 2007
408
case SDL_COPY_BLEND:
409
410
411
412
dstR = srcR + ((255 - srcA) * dstR) / 255;
dstG = srcG + ((255 - srcA) * dstG) / 255;
dstB = srcB + ((255 - srcA) * dstB) / 255;
break;
Aug 17, 2007
Aug 17, 2007
413
case SDL_COPY_ADD:
414
415
416
417
dstR = srcR + dstR; if (dstR > 255) dstR = 255;
dstG = srcG + dstG; if (dstG > 255) dstG = 255;
dstB = srcB + dstB; if (dstB > 255) dstB = 255;
break;
Feb 5, 2011
Feb 5, 2011
418
419
420
421
422
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
dstG = (srcG * dstG) / 255;
dstB = (srcB * dstB) / 255;
break;
423
424
425
426
427
428
429
}
dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
*dst = dstpixel;
posx += incx;
++dst;
}
posy += incy;
Aug 17, 2007
Aug 17, 2007
430
info->dst += info->dst_pitch;
431
432
433
}
}
Aug 17, 2007
Aug 17, 2007
434
static void SDL_Blit_RGB888_BGR888_Scale(SDL_BlitInfo *info)
435
436
437
438
439
440
441
442
443
{
Uint32 pixel;
Uint32 R, G, B, A;
int srcy, srcx;
int posy, posx;
int incy, incx;
srcy = 0;
posy = 0;
Aug 17, 2007
Aug 17, 2007
444
445
incy = (info->src_h << 16) / info->dst_h;
incx = (info->src_w << 16) / info->dst_w;
Aug 17, 2007
Aug 17, 2007
447
while (info->dst_h--) {
Mar 7, 2011
Mar 7, 2011
448
Uint32 *src = 0;
Aug 17, 2007
Aug 17, 2007
449
450
Uint32 *dst = (Uint32 *)info->dst;
int n = info->dst_w;
451
452
453
454
455
456
457
458
459
460
461
462
srcx = -1;
posx = 0x10000L;
while (posy >= 0x10000L) {
++srcy;
posy -= 0x10000L;
}
while (n--) {
if (posx >= 0x10000L) {
while (posx >= 0x10000L) {
++srcx;
posx -= 0x10000L;
}
Aug 17, 2007
Aug 17, 2007
463
src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
464
465
466
467
468
469
470
471
472
}
pixel = *src;
R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; A = 0xFF;
pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
*dst = pixel;
posx += incx;
++dst;
}
posy += incy;
Aug 17, 2007
Aug 17, 2007
473
info->dst += info->dst_pitch;
474
475
476
}
}
Aug 17, 2007
Aug 17, 2007
477
static void SDL_Blit_RGB888_BGR888_Blend(SDL_BlitInfo *info)
Aug 17, 2007
Aug 17, 2007
479
const int flags = info->flags;
480
481
482
483
484
Uint32 srcpixel;
Uint32 srcR, srcG, srcB, srcA;
Uint32 dstpixel;
Uint32 dstR, dstG, dstB, dstA;
Aug 17, 2007
Aug 17, 2007
485
486
487
488
while (info->dst_h--) {
Uint32 *src = (Uint32 *)info->src;
Uint32 *dst = (Uint32 *)info->dst;
int n = info->dst_w;
489
490
491
492
493
while (n--) {
srcpixel = *src;
srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF;
dstpixel = *dst;
dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
Aug 17, 2007
Aug 17, 2007
494
if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
495
/* This goes away if we ever use premultiplied alpha */
Aug 28, 2006
Aug 28, 2006
496
497
498
499
500
if (srcA < 255) {
srcR = (srcR * srcA) / 255;
srcG = (srcG * srcA) / 255;
srcB = (srcB * srcA) / 255;
}
Feb 5, 2011
Feb 5, 2011
502
switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
Aug 17, 2007
Aug 17, 2007
503
case SDL_COPY_BLEND:
504
505
506
507
dstR = srcR + ((255 - srcA) * dstR) / 255;
dstG = srcG + ((255 - srcA) * dstG) / 255;
dstB = srcB + ((255 - srcA) * dstB) / 255;
break;
Aug 17, 2007
Aug 17, 2007
508
case SDL_COPY_ADD:
509
510
511
512
dstR = srcR + dstR; if (dstR > 255) dstR = 255;
dstG = srcG + dstG; if (dstG > 255) dstG = 255;
dstB = srcB + dstB; if (dstB > 255) dstB = 255;
break;
Feb 5, 2011
Feb 5, 2011
513
514
515
516
517
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
dstG = (srcG * dstG) / 255;
dstB = (srcB * dstB) / 255;
break;
518
519
520
521
522
523
}
dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
*dst = dstpixel;
++src;
++dst;
}
Aug 17, 2007
Aug 17, 2007
524
525
info->src += info->src_pitch;
info->dst += info->dst_pitch;
526
527
528
}
}
Aug 17, 2007
Aug 17, 2007
529
static void SDL_Blit_RGB888_BGR888_Blend_Scale(SDL_BlitInfo *info)
Aug 17, 2007
Aug 17, 2007
531
const int flags = info->flags;
532
533
534
535
536
537
538
539
540
541
Uint32 srcpixel;
Uint32 srcR, srcG, srcB, srcA;
Uint32 dstpixel;
Uint32 dstR, dstG, dstB, dstA;
int srcy, srcx;
int posy, posx;
int incy, incx;
srcy = 0;
posy = 0;
Aug 17, 2007
Aug 17, 2007
542
543
incy = (info->src_h << 16) / info->dst_h;
incx = (info->src_w << 16) / info->dst_w;
Aug 17, 2007
Aug 17, 2007
545
while (info->dst_h--) {
Mar 7, 2011
Mar 7, 2011
546
Uint32 *src = 0;
Aug 17, 2007
Aug 17, 2007
547
548
Uint32 *dst = (Uint32 *)info->dst;
int n = info->dst_w;
549
550
551
552
553
554
555
556
557
558
559
560
srcx = -1;
posx = 0x10000L;
while (posy >= 0x10000L) {
++srcy;
posy -= 0x10000L;
}
while (n--) {
if (posx >= 0x10000L) {
while (posx >= 0x10000L) {
++srcx;
posx -= 0x10000L;
}
Aug 17, 2007
Aug 17, 2007
561
src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
562
563
564
565
566
}
srcpixel = *src;
srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF;
dstpixel = *dst;
dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
Aug 17, 2007
Aug 17, 2007
567
if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
568
/* This goes away if we ever use premultiplied alpha */
Aug 28, 2006
Aug 28, 2006
569
570
571
572
573
if (srcA < 255) {
srcR = (srcR * srcA) / 255;
srcG = (srcG * srcA) / 255;
srcB = (srcB * srcA) / 255;
}
Feb 5, 2011
Feb 5, 2011
575
switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
Aug 17, 2007
Aug 17, 2007
576
case SDL_COPY_BLEND:
577
578
579
580
dstR = srcR + ((255 - srcA) * dstR) / 255;
dstG = srcG + ((255 - srcA) * dstG) / 255;
dstB = srcB + ((255 - srcA) * dstB) / 255;
break;
Aug 17, 2007
Aug 17, 2007
581
case SDL_COPY_ADD:
582
583
584
585
dstR = srcR + dstR; if (dstR > 255) dstR = 255;
dstG = srcG + dstG; if (dstG > 255) dstG = 255;
dstB = srcB + dstB; if (dstB > 255) dstB = 255;
break;
Feb 5, 2011
Feb 5, 2011
586
587
588
589
590
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
dstG = (srcG * dstG) / 255;
dstB = (srcB * dstB) / 255;
break;
591
592
593
594
595
596
597
}
dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
*dst = dstpixel;
posx += incx;
++dst;
}
posy += incy;
Aug 17, 2007
Aug 17, 2007
598
info->dst += info->dst_pitch;
599
600
601
}
}
Aug 17, 2007
Aug 17, 2007
602
static void SDL_Blit_RGB888_BGR888_Modulate(SDL_BlitInfo *info)
Aug 17, 2007
Aug 17, 2007
604
605
606
607
608
const int flags = info->flags;
const Uint32 modulateR = info->r;
const Uint32 modulateG = info->g;
const Uint32 modulateB = info->b;
const Uint32 modulateA = info->a;
609
610
611
Uint32 pixel;
Uint32 R, G, B, A;
Aug 17, 2007
Aug 17, 2007
612
613
614
615
while (info->dst_h--) {
Uint32 *src = (Uint32 *)info->src;
Uint32 *dst = (Uint32 *)info->dst;
int n = info->dst_w;
616
617
618
while (n--) {
pixel = *src;
R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; A = 0xFF;
Aug 17, 2007
Aug 17, 2007
619
if (flags & SDL_COPY_MODULATE_COLOR) {
620
621
622
623
R = (R * modulateR) / 255;
G = (G * modulateG) / 255;
B = (B * modulateB) / 255;
}
Aug 17, 2007
Aug 17, 2007
624
if (flags & SDL_COPY_MODULATE_ALPHA) {
Aug 28, 2006
Aug 28, 2006
625
626
A = (A * modulateA) / 255;
}
627
628
629
630
631
pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
*dst = pixel;
++src;
++dst;
}
Aug 17, 2007
Aug 17, 2007
632
633
info->src += info->src_pitch;
info->dst += info->dst_pitch;
634
635
636
}
}
Aug 17, 2007
Aug 17, 2007
637
static void SDL_Blit_RGB888_BGR888_Modulate_Scale(SDL_BlitInfo *info)
Aug 17, 2007
Aug 17, 2007
639
640
641
642
643
const int flags = info->flags;
const Uint32 modulateR = info->r;
const Uint32 modulateG = info->g;
const Uint32 modulateB = info->b;
const Uint32 modulateA = info->a;
644
645
646
647
648
649
650
651
Uint32 pixel;
Uint32 R, G, B, A;
int srcy, srcx;
int posy, posx;
int incy, incx;
srcy = 0;
posy = 0;
Aug 17, 2007
Aug 17, 2007
652
653
incy = (info->src_h << 16) / info->dst_h;
incx = (info->src_w << 16) / info->dst_w;
Aug 17, 2007
Aug 17, 2007
655
while (info->dst_h--) {
Mar 7, 2011
Mar 7, 2011
656
Uint32 *src = 0;
Aug 17, 2007
Aug 17, 2007
657
658
Uint32 *dst = (Uint32 *)info->dst;
int n = info->dst_w;
659
660
661
662
663
664
665
666
667
668
669
670
srcx = -1;
posx = 0x10000L;
while (posy >= 0x10000L) {
++srcy;
posy -= 0x10000L;
}
while (n--) {
if (posx >= 0x10000L) {
while (posx >= 0x10000L) {
++srcx;
posx -= 0x10000L;
}
Aug 17, 2007
Aug 17, 2007
671
src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
672
673
674
}
pixel = *src;
R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; A = 0xFF;
Aug 17, 2007
Aug 17, 2007
675
if (flags & SDL_COPY_MODULATE_COLOR) {
676
677
678
679
R = (R * modulateR) / 255;
G = (G * modulateG) / 255;
B = (B * modulateB) / 255;
}
Aug 17, 2007
Aug 17, 2007
680
if (flags & SDL_COPY_MODULATE_ALPHA) {
Aug 28, 2006
Aug 28, 2006
681
682
A = (A * modulateA) / 255;
}
683
684
685
686
687
688
pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
*dst = pixel;
posx += incx;
++dst;
}
posy += incy;
Aug 17, 2007
Aug 17, 2007
689
info->dst += info->dst_pitch;
690
691
692
}
}
Aug 17, 2007
Aug 17, 2007
693
static void SDL_Blit_RGB888_BGR888_Modulate_Blend(SDL_BlitInfo *info)
Aug 17, 2007
Aug 17, 2007
695
696
697
698
699
const int flags = info->flags;
const Uint32 modulateR = info->r;
const Uint32 modulateG = info->g;
const Uint32 modulateB = info->b;
const Uint32 modulateA = info->a;
700
701
702
703
704
Uint32 srcpixel;
Uint32 srcR, srcG, srcB, srcA;
Uint32 dstpixel;
Uint32 dstR, dstG, dstB, dstA;
Aug 17, 2007
Aug 17, 2007
705
706
707
708
while (info->dst_h--) {
Uint32 *src = (Uint32 *)info->src;
Uint32 *dst = (Uint32 *)info->dst;
int n = info->dst_w;
709
710
711
712
713
while (n--) {
srcpixel = *src;
srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF;
dstpixel = *dst;
dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
Aug 17, 2007
Aug 17, 2007
714
if (flags & SDL_COPY_MODULATE_COLOR) {
715
716
717
718
srcR = (srcR * modulateR) / 255;
srcG = (srcG * modulateG) / 255;
srcB = (srcB * modulateB) / 255;
}
Aug 17, 2007
Aug 17, 2007
719
if (flags & SDL_COPY_MODULATE_ALPHA) {
720
721
srcA = (srcA * modulateA) / 255;
}
Aug 17, 2007
Aug 17, 2007
722
if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
723
/* This goes away if we ever use premultiplied alpha */
Aug 28, 2006
Aug 28, 2006
724
725
726
727
728
if (srcA < 255) {
srcR = (srcR * srcA) / 255;
srcG = (srcG * srcA) / 255;
srcB = (srcB * srcA) / 255;
}
Feb 5, 2011
Feb 5, 2011
730
switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
Aug 17, 2007
Aug 17, 2007
731
case SDL_COPY_BLEND:
732
733
734
735
dstR = srcR + ((255 - srcA) * dstR) / 255;
dstG = srcG + ((255 - srcA) * dstG) / 255;
dstB = srcB + ((255 - srcA) * dstB) / 255;
break;
Aug 17, 2007
Aug 17, 2007
736
case SDL_COPY_ADD:
737
738
739
740
dstR = srcR + dstR; if (dstR > 255) dstR = 255;
dstG = srcG + dstG; if (dstG > 255) dstG = 255;
dstB = srcB + dstB; if (dstB > 255) dstB = 255;
break;
Feb 5, 2011
Feb 5, 2011
741
742
743
744
745
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
dstG = (srcG * dstG) / 255;
dstB = (srcB * dstB) / 255;
break;
746
747
748
749
750
751
}
dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
*dst = dstpixel;
++src;
++dst;
}
Aug 17, 2007
Aug 17, 2007
752
753
info->src += info->src_pitch;
info->dst += info->dst_pitch;
754
755
756
}
}
Aug 17, 2007
Aug 17, 2007
757
static void SDL_Blit_RGB888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info)
Aug 17, 2007
Aug 17, 2007
759
760
761
762
763
const int flags = info->flags;
const Uint32 modulateR = info->r;
const Uint32 modulateG = info->g;
const Uint32 modulateB = info->b;
const Uint32 modulateA = info->a;
764
765
766
767
768
769
770
771
772
773
Uint32 srcpixel;
Uint32 srcR, srcG, srcB, srcA;
Uint32 dstpixel;
Uint32 dstR, dstG, dstB, dstA;
int srcy, srcx;
int posy, posx;
int incy, incx;
srcy = 0;
posy = 0;
Aug 17, 2007
Aug 17, 2007
774
775
incy = (info->src_h << 16) / info->dst_h;
incx = (info->src_w << 16) / info->dst_w;
Aug 17, 2007
Aug 17, 2007
777
while (info->dst_h--) {
Mar 7, 2011
Mar 7, 2011
778
Uint32 *src = 0;
Aug 17, 2007
Aug 17, 2007
779
780
Uint32 *dst = (Uint32 *)info->dst;
int n = info->dst_w;
781
782
783
784
785
786
787
788
789
790
791
792
srcx = -1;
posx = 0x10000L;
while (posy >= 0x10000L) {
++srcy;
posy -= 0x10000L;
}
while (n--) {
if (posx >= 0x10000L) {
while (posx >= 0x10000L) {
++srcx;
posx -= 0x10000L;
}
Aug 17, 2007
Aug 17, 2007
793
src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
794
795
796
797
798
}
srcpixel = *src;
srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF;
dstpixel = *dst;
dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
Aug 17, 2007
Aug 17, 2007
799
if (flags & SDL_COPY_MODULATE_COLOR) {
800
801
802
803
srcR = (srcR * modulateR) / 255;
srcG = (srcG * modulateG) / 255;
srcB = (srcB * modulateB) / 255;
}
Aug 17, 2007
Aug 17, 2007
804
if (flags & SDL_COPY_MODULATE_ALPHA) {
805
806
srcA = (srcA * modulateA) / 255;
}
Aug 17, 2007
Aug 17, 2007
807
if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
808
/* This goes away if we ever use premultiplied alpha */
Aug 28, 2006
Aug 28, 2006
809
810
811
812
813
if (srcA < 255) {
srcR = (srcR * srcA) / 255;
srcG = (srcG * srcA) / 255;
srcB = (srcB * srcA) / 255;
}
Feb 5, 2011
Feb 5, 2011
815
switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
Aug 17, 2007
Aug 17, 2007
816
case SDL_COPY_BLEND:
817
818
819
820
dstR = srcR + ((255 - srcA) * dstR) / 255;
dstG = srcG + ((255 - srcA) * dstG) / 255;
dstB = srcB + ((255 - srcA) * dstB) / 255;
break;
Aug 17, 2007
Aug 17, 2007
821
case SDL_COPY_ADD:
822
823
824
825
dstR = srcR + dstR; if (dstR > 255) dstR = 255;
dstG = srcG + dstG; if (dstG > 255) dstG = 255;
dstB = srcB + dstB; if (dstB > 255) dstB = 255;
break;
Feb 5, 2011
Feb 5, 2011
826
827
828
829
830
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
dstG = (srcG * dstG) / 255;
dstB = (srcB * dstB) / 255;
break;
831
832
833
834
835
836
837
}
dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
*dst = dstpixel;
posx += incx;
++dst;
}
posy += incy;
Aug 17, 2007
Aug 17, 2007
838
info->dst += info->dst_pitch;
839
840
841
}
}
Nov 29, 2008
Nov 29, 2008
842
static void SDL_Blit_RGB888_ARGB8888_Scale(SDL_BlitInfo *info)
843
844
845
846
847
848
849
850
851
{
Uint32 pixel;
Uint32 R, G, B, A;
int srcy, srcx;
int posy, posx;
int incy, incx;
srcy = 0;
posy = 0;
Aug 17, 2007
Aug 17, 2007
852
853
incy = (info->src_h << 16) / info->dst_h;
incx = (info->src_w << 16) / info->dst_w;
Aug 17, 2007
Aug 17, 2007
855
while (info->dst_h--) {
Mar 7, 2011
Mar 7, 2011
856
Uint32 *src = 0;
Aug 17, 2007
Aug 17, 2007
857
858
Uint32 *dst = (Uint32 *)info->dst;
int n = info->dst_w;
859
860
861
862
863
864
865
866
867
868
869
870
srcx = -1;
posx = 0x10000L;
while (posy >= 0x10000L) {
++srcy;
posy -= 0x10000L;
}
while (n--) {
if (posx >= 0x10000L) {
while (posx >= 0x10000L) {
++srcx;
posx -= 0x10000L;
}
Aug 17, 2007
Aug 17, 2007
871
src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
872
873
}
pixel = *src;
Nov 29, 2008
Nov 29, 2008
874
875
R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; A = 0xFF;
pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B;
876
877
878
879
880
*dst = pixel;
posx += incx;
++dst;
}
posy += incy;
Aug 17, 2007
Aug 17, 2007
881
info->dst += info->dst_pitch;
882
883
884
}
}
Nov 29, 2008
Nov 29, 2008
885
static void SDL_Blit_RGB888_ARGB8888_Blend(SDL_BlitInfo *info)
Aug 17, 2007
Aug 17, 2007
887
const int flags = info->flags;
888
889
890
891
892
Uint32 srcpixel;
Uint32 srcR, srcG, srcB, srcA;
Uint32 dstpixel;
Uint32 dstR, dstG, dstB, dstA;
Aug 17, 2007
Aug 17, 2007
893
894
895
896
while (info->dst_h--) {
Uint32 *src = (Uint32 *)info->src;
Uint32 *dst = (Uint32 *)info->dst;
int n = info->dst_w;
897
898
while (n--) {
srcpixel = *src;
Nov 29, 2008
Nov 29, 2008
899
srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF;
900
dstpixel = *dst;
Nov 29, 2008
Nov 29, 2008
901
dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
Aug 17, 2007
Aug 17, 2007
902
if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
903
/* This goes away if we ever use premultiplied alpha */
Aug 28, 2006
Aug 28, 2006
904
905
906
907
908
if (srcA < 255) {
srcR = (srcR * srcA) / 255;
srcG = (srcG * srcA) / 255;
srcB = (srcB * srcA) / 255;
}
Feb 5, 2011
Feb 5, 2011
910
switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
Aug 17, 2007
Aug 17, 2007
911
case SDL_COPY_BLEND:
912
913
914
915
dstR = srcR + ((255 - srcA) * dstR) / 255;
dstG = srcG + ((255 - srcA) * dstG) / 255;
dstB = srcB + ((255 - srcA) * dstB) / 255;
break;
Aug 17, 2007
Aug 17, 2007
916
case SDL_COPY_ADD:
917
918
919
920
dstR = srcR + dstR; if (dstR > 255) dstR = 255;
dstG = srcG + dstG; if (dstG > 255) dstG = 255;
dstB = srcB + dstB; if (dstB > 255) dstB = 255;
break;
Feb 5, 2011
Feb 5, 2011
921
922
923
924
925
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
dstG = (srcG * dstG) / 255;
dstB = (srcB * dstB) / 255;
break;
Nov 29, 2008
Nov 29, 2008
927
dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
928
929
930
931
*dst = dstpixel;
++src;
++dst;
}
Aug 17, 2007
Aug 17, 2007
932
933
info->src += info->src_pitch;
info->dst += info->dst_pitch;
934
935
936
}
}
Nov 29, 2008
Nov 29, 2008
937
static void SDL_Blit_RGB888_ARGB8888_Blend_Scale(SDL_BlitInfo *info)
Aug 17, 2007
Aug 17, 2007
939
const int flags = info->flags;
940
941
942
943
944
945
946
947
948
949
Uint32 srcpixel;
Uint32 srcR, srcG, srcB, srcA;
Uint32 dstpixel;
Uint32 dstR, dstG, dstB, dstA;
int srcy, srcx;
int posy, posx;
int incy, incx;
srcy = 0;
posy = 0;
Aug 17, 2007
Aug 17, 2007
950
951
incy = (info->src_h << 16) / info->dst_h;
incx = (info->src_w << 16) / info->dst_w;
Aug 17, 2007
Aug 17, 2007
953
while (info->dst_h--) {
Mar 7, 2011
Mar 7, 2011
954
Uint32 *src = 0;
Aug 17, 2007
Aug 17, 2007
955
956
Uint32 *dst = (Uint32 *)info->dst;
int n = info->dst_w;
957
958
959
960
961
962
963
964
965
966
967
968
srcx = -1;
posx = 0x10000L;
while (posy >= 0x10000L) {
++srcy;
posy -= 0x10000L;
}
while (n--) {
if (posx >= 0x10000L) {
while (posx >= 0x10000L) {
++srcx;
posx -= 0x10000L;
}
Aug 17, 2007
Aug 17, 2007
969
src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
970
971
}
srcpixel = *src;
Nov 29, 2008
Nov 29, 2008
972
srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF;
973
dstpixel = *dst;
Nov 29, 2008
Nov 29, 2008
974
dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
Aug 17, 2007
Aug 17, 2007
975
if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
976
/* This goes away if we ever use premultiplied alpha */
Aug 28, 2006
Aug 28, 2006
977
978
979
980
981
if (srcA < 255) {
srcR = (srcR * srcA) / 255;
srcG = (srcG * srcA) / 255;
srcB = (srcB * srcA) / 255;
}
Feb 5, 2011
Feb 5, 2011
983
switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
Aug 17, 2007
Aug 17, 2007
984
case SDL_COPY_BLEND:
985
986
987
988
dstR = srcR + ((255 - srcA) * dstR) / 255;
dstG = srcG + ((255 - srcA) * dstG) / 255;
dstB = srcB + ((255 - srcA) * dstB) / 255;
break;
Aug 17, 2007
Aug 17, 2007
989
case SDL_COPY_ADD:
990
991
992
993
dstR = srcR + dstR; if (dstR > 255) dstR = 255;
dstG = srcG + dstG; if (dstG > 255) dstG = 255;
dstB = srcB + dstB; if (dstB > 255) dstB = 255;
break;
Feb 5, 2011
Feb 5, 2011
994
995
996
997
998
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
dstG = (srcG * dstG) / 255;
dstB = (srcB * dstB) / 255;
break;
Nov 29, 2008
Nov 29, 2008
1000
dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;