138 GLfloat ascale = 256.0f *
ctx->Visual->InvAlphaScale;
148 r = (
red[
i] *
t + rdest[
i] *
s) >> 8;
171 for (
i=0;
i <
n;
i++) {
187 if (
ctx->Visual->EightBitColor) {
188 for (
i=0;
i <
n;
i++) {
202 for (
i=0;
i <
n;
i++) {
215 if (
ctx->Visual->EightBitColor) {
218 GLint Rs, Gs, Bs, As;
220 GLint Rss, Gss, Bss, Ass;
221 GLint Rds, Gds, Bds, Ads;
236 switch (
ctx->Color.BlendSrc) {
238 Rss = Gss = Bss = Ass = 0;
253 Rss = Rs * (255 -
Rd);
254 Gss = Gs * (255 -
Gd);
255 Bss = Bs * (255 - Bd);
256 Ass = As * (255 - Ad);
265 Rss = Rs * (255 - As);
266 Gss = Gs * (255 - As);
267 Bss = Bs * (255 - As);
268 Ass = As * (255 - As);
277 Rss = Rs * (255 - Ad);
278 Gss = Gs * (255 - Ad);
279 Bss = Bs * (255 - Ad);
280 Ass = As * (255 - Ad);
297 switch (
ctx->Color.BlendDst) {
299 Rds = Gds = Bds = Ads = 0;
314 Rds = Rs * (255 - Rs);
315 Gds = Gs * (255 - Gs);
316 Bds = Bs * (255 - Bs);
317 Ads = As * (255 - As);
326 Rds =
Rd * (255 - As);
327 Gds =
Gd * (255 - As);
328 Bds = Bd * (255 - As);
329 Ads = Ad * (255 - As);
338 Rds =
Rd * (255 - Ad);
339 Gds =
Gd * (255 - Ad);
340 Bds = Bd * (255 - Ad);
341 Ads = Ad * (255 - Ad);
349 red[
i] =
MIN2((Rss + Rds) / 255, 255);
367 GLint Rs, Gs, Bs, As;
386 switch (
ctx->Color.BlendSrc) {
388 sR = sG = sB = sA = 0.0F;
391 sR = sG = sB = sA = 1.0F;
402 sB = 1.0F - (
GLfloat) Bd * bscale;
403 sA = 1.0F - (
GLfloat) Ad * ascale;
406 sR = sG = sB = sA = (
GLfloat) As * ascale;
412 sR = sG = sB = sA =(
GLfloat) Ad * ascale;
415 sR = sG = sB = sA = 1.0F - (
GLfloat) Ad * ascale;
418 if (As < 1.0F - (
GLfloat) Ad * ascale) {
419 sR = sG = sB = (
GLfloat) As * ascale;
422 sR = sG = sB = 1.0F - (
GLfloat) Ad * ascale;
432 switch (
ctx->Color.BlendDst) {
434 dR = dG = dB = dA = 0.0F;
437 dR = dG = dB = dA = 1.0F;
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;
452 dR = dG = dB = dA = (
GLfloat) As * ascale;
458 dR = dG = dB = dA = (
GLfloat) Ad * ascale;
461 dR = dG = dB = dA = 1.0F - (
GLfloat) Ad * ascale;
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 );
480 r = Rs * sR +
Rd * dR;
481 g = Gs * sG +
Gd * dG;
482 b = Bs * sB + Bd * dB;
483 a = As * sA + Ad * dA;
518 do_blend(
ctx,
n,
mask,
red,
green,
blue,
alpha, rdest, gdest, bdest, adest );
541 (*
ctx->Driver.ReadColorPixels)(
ctx,
n,
x,
y, rdest, gdest, bdest, adest,
mask );
546 do_blend(
ctx,
n,
mask,
red,
green,
blue,
alpha, rdest, gdest, bdest, adest );
void gl_read_alpha_pixels(GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], GLubyte alpha[], const GLubyte mask[])
static void do_blend(GLcontext *ctx, GLuint n, const GLubyte mask[], GLubyte red[], GLubyte green[], GLubyte blue[], GLubyte alpha[], const GLubyte rdest[], const GLubyte gdest[], const GLubyte bdest[], const GLubyte adest[])
void gl_BlendFunc(GLcontext *ctx, GLenum sfactor, GLenum dfactor)
void gl_blend_span(GLcontext *ctx, GLuint n, GLint x, GLint y, GLubyte red[], GLubyte green[], GLubyte blue[], GLubyte alpha[], GLubyte mask[])
void gl_blend_pixels(GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], GLubyte red[], GLubyte green[], GLubyte blue[], GLubyte alpha[], GLubyte mask[])
void gl_problem(const GLcontext *ctx, const char *s)
void gl_error(GLcontext *ctx, GLenum error, const char *s)
GLint GLint GLint GLint GLint x
#define GL_SRC_ALPHA_SATURATE
#define GL_ONE_MINUS_DST_ALPHA
#define GL_ONE_MINUS_DST_COLOR
#define GL_INVALID_OPERATION
GLclampf GLclampf GLclampf alpha
GLint GLint GLint GLint GLint GLint y
#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
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 GLint GLint GLenum GLenum dfactor
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 GLint GLint GLenum sfactor
#define INSIDE_BEGIN_END(CTX)
void gl_read_color_span(GLcontext *ctx, GLuint n, GLint x, GLint y, GLubyte red[], GLubyte green[], GLubyte blue[], GLubyte alpha[])
#define CLAMP(f, min, max)