ReactOS 0.4.15-dev-7788-g1ad9096
alpha.h File Reference
#include "types.h"
Include dependency graph for alpha.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

GLint gl_alpha_test (GLcontext *ctx, GLuint n, const GLubyte alpha[], GLubyte mask[])
 
void gl_AlphaFunc (GLcontext *ctx, GLenum func, GLclampf ref)
 

Function Documentation

◆ gl_alpha_test()

GLint gl_alpha_test ( GLcontext ctx,
GLuint  n,
const GLubyte  alpha[],
GLubyte  mask[] 
)

Definition at line 92 of file alpha.c.

94{
95 GLuint i;
96 GLubyte ref = ctx->Color.AlphaRefUbyte;
97
98 /* switch cases ordered from most frequent to less frequent */
99 switch (ctx->Color.AlphaFunc) {
100 case GL_LESS:
101 for (i=0;i<n;i++) {
102 mask[i] &= (alpha[i] < ref);
103 }
104 return 1;
105 case GL_LEQUAL:
106 for (i=0;i<n;i++) {
107 mask[i] &= (alpha[i] <= ref);
108 }
109 return 1;
110 case GL_GEQUAL:
111 for (i=0;i<n;i++) {
112 mask[i] &= (alpha[i] >= ref);
113 }
114 return 1;
115 case GL_GREATER:
116 for (i=0;i<n;i++) {
117 mask[i] &= (alpha[i] > ref);
118 }
119 return 1;
120 case GL_NOTEQUAL:
121 for (i=0;i<n;i++) {
122 mask[i] &= (alpha[i] != ref);
123 }
124 return 1;
125 case GL_EQUAL:
126 for (i=0;i<n;i++) {
127 mask[i] &= (alpha[i] == ref);
128 }
129 return 1;
130 case GL_ALWAYS:
131 /* do nothing */
132 return 1;
133 case GL_NEVER:
134 /* caller should check for zero! */
135 return 0;
136 default:
137 gl_problem( ctx, "Invalid alpha test in gl_alpha_test" );
138 return 0;
139 }
140 /* Never get here */
141 return 1;
142}
void gl_problem(const GLcontext *ctx, const char *s)
Definition: context.c:1394
#define GL_NEVER
Definition: gl.h:293
unsigned char GLubyte
Definition: gl.h:157
#define GL_ALWAYS
Definition: gl.h:300
#define GL_LESS
Definition: gl.h:294
#define GL_NOTEQUAL
Definition: gl.h:298
GLclampf GLclampf GLclampf alpha
Definition: gl.h:1740
unsigned int GLuint
Definition: gl.h:159
#define GL_LEQUAL
Definition: gl.h:296
#define GL_GEQUAL
Definition: gl.h:299
#define GL_GREATER
Definition: gl.h:297
#define GL_EQUAL
Definition: gl.h:295
GLdouble n
Definition: glext.h:7729
GLenum GLint GLuint mask
Definition: glext.h:6028
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
Definition: glfuncs.h:248
Definition: send.c:48

Referenced by gl_flush_pb(), gl_write_color_span(), gl_write_monocolor_span(), and gl_write_texture_span().

◆ gl_AlphaFunc()

void gl_AlphaFunc ( GLcontext ctx,
GLenum  func,
GLclampf  ref 
)

Definition at line 56 of file alpha.c.

57{
58 if (INSIDE_BEGIN_END(ctx)) {
59 gl_error( ctx, GL_INVALID_OPERATION, "glAlphaFunc" );
60 return;
61 }
62 switch (func) {
63 case GL_NEVER:
64 case GL_LESS:
65 case GL_EQUAL:
66 case GL_LEQUAL:
67 case GL_GREATER:
68 case GL_NOTEQUAL:
69 case GL_GEQUAL:
70 case GL_ALWAYS:
71 ctx->Color.AlphaFunc = func;
72 ctx->Color.AlphaRef = CLAMP( ref, 0.0F, 1.0F );
73 ctx->Color.AlphaRefUbyte = (GLubyte) (ctx->Color.AlphaRef
74 * ctx->Visual->AlphaScale);
75 break;
76 default:
77 gl_error( ctx, GL_INVALID_ENUM, "glAlphaFunc(func)" );
78 break;
79 }
80}
void gl_error(GLcontext *ctx, GLenum error, const char *s)
Definition: context.c:1421
#define GL_INVALID_OPERATION
Definition: gl.h:696
#define GL_INVALID_ENUM
Definition: gl.h:694
GLenum func
Definition: glext.h:6028
#define INSIDE_BEGIN_END(CTX)
Definition: macros.h:135
#define CLAMP(f, min, max)
Definition: tif_color.c:177

Referenced by execute_list(), and init_exec_pointers().