ReactOS 0.4.16-dev-92-g0c2cdca
alphabuf.h File Reference
#include "types.h"
Include dependency graph for alphabuf.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void gl_alloc_alpha_buffers (GLcontext *ctx)
 
void gl_clear_alpha_buffers (GLcontext *ctx)
 
void gl_write_alpha_span (GLcontext *ctx, GLuint n, GLint x, GLint y, GLubyte alpha[], GLubyte mask[])
 
void gl_write_mono_alpha_span (GLcontext *ctx, GLuint n, GLint x, GLint y, GLubyte alpha, GLubyte mask[])
 
void gl_write_alpha_pixels (GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], const GLubyte alpha[], const GLubyte mask[])
 
void gl_write_mono_alpha_pixels (GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], GLubyte alpha, const GLubyte mask[])
 
void gl_read_alpha_span (GLcontext *ctx, GLuint n, GLint x, GLint y, GLubyte alpha[])
 
void gl_read_alpha_pixels (GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], GLubyte alpha[], const GLubyte mask[])
 

Function Documentation

◆ gl_alloc_alpha_buffers()

void gl_alloc_alpha_buffers ( GLcontext ctx)

Definition at line 71 of file alphabuf.c.

72{
73 GLint bytes = ctx->Buffer->Width * ctx->Buffer->Height * sizeof(GLubyte);
74
75 if (ctx->Visual->FrontAlphaEnabled) {
76 if (ctx->Buffer->FrontAlpha) {
77 free( ctx->Buffer->FrontAlpha );
78 }
79 ctx->Buffer->FrontAlpha = (GLubyte *) malloc( bytes );
80 if (!ctx->Buffer->FrontAlpha) {
81 /* out of memory */
82 gl_error( ctx, GL_OUT_OF_MEMORY, "Couldn't allocate front alpha buffer" );
83 }
84 }
85 if (ctx->Visual->BackAlphaEnabled) {
86 if (ctx->Buffer->BackAlpha) {
87 free( ctx->Buffer->BackAlpha );
88 }
89 ctx->Buffer->BackAlpha = (GLubyte *) malloc( bytes );
90 if (!ctx->Buffer->BackAlpha) {
91 /* out of memory */
92 gl_error( ctx, GL_OUT_OF_MEMORY, "Couldn't allocate back alpha buffer" );
93 }
94 }
95 if (ctx->Color.DrawBuffer==GL_FRONT) {
96 ctx->Buffer->Alpha = ctx->Buffer->FrontAlpha;
97 }
98 if (ctx->Color.DrawBuffer==GL_BACK) {
99 ctx->Buffer->Alpha = ctx->Buffer->BackAlpha;
100 }
101}
static unsigned char bytes[4]
Definition: adnsresfilter.c:74
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
void gl_error(GLcontext *ctx, GLenum error, const char *s)
Definition: context.c:1421
unsigned char GLubyte
Definition: gl.h:157
#define GL_BACK
Definition: gl.h:271
int GLint
Definition: gl.h:156
#define GL_OUT_OF_MEMORY
Definition: gl.h:699
#define GL_FRONT
Definition: gl.h:270

Referenced by gl_ResizeBuffersMESA().

◆ gl_clear_alpha_buffers()

void gl_clear_alpha_buffers ( GLcontext ctx)

Definition at line 108 of file alphabuf.c.

109{
111
112 /* Loop over front and back buffers */
113 for (buffer=0;buffer<2;buffer++) {
114
115 /* Get pointer to front or back buffer */
116 GLubyte *abuffer = NULL;
117 if (buffer==0
118 && ( ctx->Color.DrawBuffer==GL_FRONT
119 || ctx->Color.DrawBuffer==GL_FRONT_AND_BACK)
120 && ctx->Visual->FrontAlphaEnabled && ctx->Buffer->FrontAlpha) {
121 abuffer = ctx->Buffer->FrontAlpha;
122 }
123 else if (buffer==1
124 && ( ctx->Color.DrawBuffer==GL_BACK
125 || ctx->Color.DrawBuffer==GL_FRONT_AND_BACK)
126 && ctx->Visual->BackAlphaEnabled && ctx->Buffer->BackAlpha) {
127 abuffer = ctx->Buffer->BackAlpha;
128 }
129
130 /* Clear the alpha buffer */
131 if (abuffer) {
132 GLubyte aclear = (GLint) (ctx->Color.ClearColor[3]
133 * ctx->Visual->AlphaScale);
134 if (ctx->Scissor.Enabled) {
135 /* clear scissor region */
136 GLint i, j;
137 for (j=0;j<ctx->Scissor.Height;j++) {
138 GLubyte *aptr = ALPHA_ADDR(ctx->Buffer->Xmin,
139 ctx->Buffer->Ymin+j);
140 for (i=0;i<ctx->Scissor.Width;i++) {
141 *aptr++ = aclear;
142 }
143 }
144 }
145 else {
146 /* clear whole buffer */
147 MEMSET( abuffer, aclear, ctx->Buffer->Width*ctx->Buffer->Height );
148 }
149 }
150 }
151}
#define ALPHA_ADDR(X, Y)
Definition: alphabuf.c:64
#define NULL
Definition: types.h:112
#define GL_FRONT_AND_BACK
Definition: gl.h:336
GLuint buffer
Definition: glext.h:5915
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
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 j
Definition: glfuncs.h:250
#define MEMSET(DST, VAL, N)
Definition: macros.h:241

Referenced by clear_color_buffers().

◆ gl_read_alpha_pixels()

void gl_read_alpha_pixels ( GLcontext ctx,
GLuint  n,
const GLint  x[],
const GLint  y[],
GLubyte  alpha[],
const GLubyte  mask[] 
)

Definition at line 257 of file alphabuf.c.

260{
261 GLuint i;
262 for (i=0;i<n;i++) {
263 if (mask[i]) {
264 GLubyte *aptr = ALPHA_ADDR( x[i], y[i] );
265 alpha[i] = *aptr;
266 }
267 }
268}
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLclampf GLclampf GLclampf alpha
Definition: gl.h:1740
unsigned int GLuint
Definition: gl.h:159
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLdouble n
Definition: glext.h:7729
GLenum GLint GLuint mask
Definition: glext.h:6028

Referenced by gl_blend_pixels(), gl_logicop_rgba_pixels(), and gl_mask_color_pixels().

◆ gl_read_alpha_span()

void gl_read_alpha_span ( GLcontext ctx,
GLuint  n,
GLint  x,
GLint  y,
GLubyte  alpha[] 
)

Definition at line 246 of file alphabuf.c.

248{
249 GLubyte *aptr = ALPHA_ADDR( x, y );
250 GLuint i;
251 for (i=0;i<n;i++) {
252 alpha[i] = *aptr++;
253 }
254}

Referenced by gl_read_color_span(), and read_color_pixels().

◆ gl_write_alpha_pixels()

void gl_write_alpha_pixels ( GLcontext ctx,
GLuint  n,
const GLint  x[],
const GLint  y[],
const GLubyte  alpha[],
const GLubyte  mask[] 
)

Definition at line 199 of file alphabuf.c.

202{
203 GLuint i;
204
205 if (mask) {
206 for (i=0;i<n;i++) {
207 if (mask[i]) {
208 GLubyte *aptr = ALPHA_ADDR( x[i], y[i] );
209 *aptr = alpha[i];
210 }
211 }
212 }
213 else {
214 for (i=0;i<n;i++) {
215 GLubyte *aptr = ALPHA_ADDR( x[i], y[i] );
216 *aptr = alpha[i];
217 }
218 }
219}

Referenced by gl_flush_pb().

◆ gl_write_alpha_span()

void gl_write_alpha_span ( GLcontext ctx,
GLuint  n,
GLint  x,
GLint  y,
GLubyte  alpha[],
GLubyte  mask[] 
)

Definition at line 155 of file alphabuf.c.

157{
158 GLubyte *aptr = ALPHA_ADDR( x, y );
159 GLuint i;
160
161 if (mask) {
162 for (i=0;i<n;i++) {
163 if (mask[i]) {
164 *aptr = alpha[i];
165 }
166 aptr++;
167 }
168 }
169 else {
170 for (i=0;i<n;i++) {
171 *aptr++ = alpha[i];
172 }
173 }
174}

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

◆ gl_write_mono_alpha_pixels()

void gl_write_mono_alpha_pixels ( GLcontext ctx,
GLuint  n,
const GLint  x[],
const GLint  y[],
GLubyte  alpha,
const GLubyte  mask[] 
)

Definition at line 222 of file alphabuf.c.

225{
226 GLuint i;
227
228 if (mask) {
229 for (i=0;i<n;i++) {
230 if (mask[i]) {
231 GLubyte *aptr = ALPHA_ADDR( x[i], y[i] );
232 *aptr = alpha;
233 }
234 }
235 }
236 else {
237 for (i=0;i<n;i++) {
238 GLubyte *aptr = ALPHA_ADDR( x[i], y[i] );
239 *aptr = alpha;
240 }
241 }
242}

Referenced by gl_flush_pb().

◆ gl_write_mono_alpha_span()

void gl_write_mono_alpha_span ( GLcontext ctx,
GLuint  n,
GLint  x,
GLint  y,
GLubyte  alpha,
GLubyte  mask[] 
)

Definition at line 177 of file alphabuf.c.

179{
180 GLubyte *aptr = ALPHA_ADDR( x, y );
181 GLuint i;
182
183 if (mask) {
184 for (i=0;i<n;i++) {
185 if (mask[i]) {
186 *aptr = alpha;
187 }
188 aptr++;
189 }
190 }
191 else {
192 for (i=0;i<n;i++) {
193 *aptr++ = alpha;
194 }
195 }
196}

Referenced by gl_write_monocolor_span().