132{
134
137
138 GLfloat ascale = 256.0f *
ctx->Visual->InvAlphaScale;
148 r = (
red[
i] *
t + rdest[
i] *
s) >> 8;
152
153
154
159 }
160 }
161 }
162 else {
163
164
171 for (
i=0;
i <
n;
i++) {
177 }
178 }
179 }
180
181
184 ||
187 if (
ctx->Visual->EightBitColor) {
188 for (
i=0;
i <
n;
i++) {
194 }
195 }
196 }
197 else {
202 for (
i=0;
i <
n;
i++) {
208 }
209 }
210 }
211 }else{
212
213
214
215 if (
ctx->Visual->EightBitColor) {
218 GLint Rs, Gs, Bs, As;
220 GLint Rss, Gss, Bss, Ass;
221 GLint Rds, Gds, Bds, Ads;
222
223
228
229
234
235
236 switch (
ctx->Color.BlendSrc) {
238 Rss = Gss = Bss = Ass = 0;
239 break;
241 Rss = Rs * 255;
242 Gss = Gs * 255;
243 Bss = Bs * 255;
244 Ass = As * 255;
245 break;
249 Bss = Bs * Bd;
250 Ass = As * Ad;
251 break;
253 Rss = Rs * (255 -
Rd);
254 Gss = Gs * (255 -
Gd);
255 Bss = Bs * (255 - Bd);
256 Ass = As * (255 - Ad);
257 break;
259 Rss = Rs * As;
260 Gss = Gs * As;
261 Bss = Bs * As;
262 Ass = As * As;
263 break;
265 Rss = Rs * (255 - As);
266 Gss = Gs * (255 - As);
267 Bss = Bs * (255 - As);
268 Ass = As * (255 - As);
269 break;
271 Rss = Rs * Ad;
272 Gss = Gs * Ad;
273 Bss = Bs * Ad;
274 Ass = As * Ad;
275 break;
277 Rss = Rs * (255 - Ad);
278 Gss = Gs * (255 - Ad);
279 Bss = Bs * (255 - Ad);
280 Ass = As * (255 - Ad);
281 break;
283 {
285 Rss = Rs * sA;
286 Gss = Gs * sA;
287 Bss = Bs * sA;
288 Ass = As * 255;
289 break;
290 }
291 default:
292
294 }
295
296
297 switch (
ctx->Color.BlendDst) {
299 Rds = Gds = Bds = Ads = 0;
300 break;
304 Bds = Bd * 255;
305 Ads = Ad * 255;
306 break;
310 Bds = Bd * Bs;
311 Ads = Ad * As;
312 break;
314 Rds = Rs * (255 - Rs);
315 Gds = Gs * (255 - Gs);
316 Bds = Bs * (255 - Bs);
317 Ads = As * (255 - As);
318 break;
322 Bds = Bd * As;
323 Ads = Ad * As;
324 break;
326 Rds =
Rd * (255 - As);
327 Gds =
Gd * (255 - As);
328 Bds = Bd * (255 - As);
329 Ads = Ad * (255 - As);
330 break;
334 Bds = Bd * Ad;
335 Ads = Ad * Ad;
336 break;
338 Rds =
Rd * (255 - Ad);
339 Gds =
Gd * (255 - Ad);
340 Bds = Bd * (255 - Ad);
341 Ads = Ad * (255 - Ad);
342 break;
343 default:
344
346 }
347
348
349 red[
i] =
MIN2((Rss + Rds) / 255, 255);
353 }
354 }
355 }else{
364
367 GLint Rs, Gs, Bs, As;
372
373
378
379
384
385
386 switch (
ctx->Color.BlendSrc) {
388 sR = sG = sB = sA = 0.0F;
389 break;
391 sR = sG = sB = sA = 1.0F;
392 break;
398 break;
402 sB = 1.0F - (
GLfloat) Bd * bscale;
403 sA = 1.0F - (
GLfloat) Ad * ascale;
404 break;
406 sR = sG = sB = sA = (
GLfloat) As * ascale;
407 break;
410 break;
412 sR = sG = sB = sA =(
GLfloat) Ad * ascale;
413 break;
415 sR = sG = sB = sA = 1.0F - (
GLfloat) Ad * ascale;
416 break;
418 if (As < 1.0F - (
GLfloat) Ad * ascale) {
419 sR = sG = sB = (
GLfloat) As * ascale;
420 }
421 else {
422 sR = sG = sB = 1.0F - (
GLfloat) Ad * ascale;
423 }
424 sA = 1.0;
425 break;
426 default:
427
429 }
430
431
432 switch (
ctx->Color.BlendDst) {
434 dR = dG = dB = dA = 0.0F;
435 break;
437 dR = dG = dB = dA = 1.0F;
438 break;
444 break;
446 dR = 1.0F - (
GLfloat) Rs * rscale;
447 dG = 1.0F - (
GLfloat) Gs * gscale;
448 dB = 1.0F - (
GLfloat) Bs * bscale;
449 dA = 1.0F - (
GLfloat) As * ascale;
450 break;
452 dR = dG = dB = dA = (
GLfloat) As * ascale;
453 break;
456 break;
458 dR = dG = dB = dA = (
GLfloat) Ad * ascale;
459 break;
461 dR = dG = dB = dA = 1.0F - (
GLfloat) Ad * ascale;
462 break;
463 default:
464
466 }
467
468#ifdef DEBUG
469 assert( sR>= 0.0 && sR<=1.0 );
470 assert( sG>= 0.0 && sG<=1.0 );
471 assert( sB>= 0.0 && sB<=1.0 );
472 assert( sA>= 0.0 && sA<=1.0 );
473 assert( dR>= 0.0 && dR<=1.0 );
474 assert( dG>= 0.0 && dG<=1.0 );
475 assert( dB>= 0.0 && dB<=1.0 );
476 assert( dA>= 0.0 && dA<=1.0 );
477#endif
478
479
480 r = Rs * sR +
Rd * dR;
481 g = Gs * sG +
Gd * dG;
482 b = Bs * sB + Bd * dB;
483 a = As * sA + Ad * dA;
488 }
489 }
490 }
491 }
492 }
493
494}
void gl_problem(const GLcontext *ctx, const char *s)
#define GL_SRC_ALPHA_SATURATE
#define GL_ONE_MINUS_DST_ALPHA
#define GL_ONE_MINUS_DST_COLOR
GLclampf GLclampf GLclampf alpha
#define GL_ONE_MINUS_SRC_ALPHA
GLdouble GLdouble GLdouble r
#define GL_ONE_MINUS_SRC_COLOR
GLboolean GLboolean GLboolean b
GLboolean GLboolean GLboolean GLboolean a
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
#define CLAMP(f, min, max)