-/* $Id: s_accum.c,v 1.3 2000/11/13 20:02:57 keithw Exp $ */
+/* $Id: s_accum.c,v 1.5 2001/03/03 20:33:30 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.5
*
- * Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
#include "mem.h"
#include "s_accum.h"
+#include "s_alphabuf.h"
#include "s_context.h"
#include "s_masking.h"
#include "s_span.h"
ctx->DrawBuffer->Accum = (GLaccum *) MALLOC( n );
if (!ctx->DrawBuffer->Accum) {
/* unable to setup accumulation buffer */
- gl_error( ctx, GL_OUT_OF_MEMORY, "glAccum" );
+ _mesa_error( ctx, GL_OUT_OF_MEMORY, "glAccum" );
}
#ifdef USE_OPTIMIZED_ACCUM
swrast->_IntegerAccumMode = GL_TRUE;
GLuint buffersize;
GLfloat acc_scale;
- if (ctx->Visual.AccumRedBits==0) {
+ if (ctx->Visual.accumRedBits==0) {
/* No accumulation buffer! */
return;
}
for (j = 0; j < height; j++) {
GLuint i, i4;
- gl_read_rgba_span(ctx, ctx->DrawBuffer, width, xpos, ypos, rgba);
+ _mesa_read_rgba_span(ctx, ctx->DrawBuffer, width, xpos, ypos, rgba);
for (i = i4 = 0; i < width; i++, i4+=4) {
acc[i4+0] += rgba[i][RCOMP];
acc[i4+1] += rgba[i][GCOMP];
for (j=0;j<height;j++) {
GLaccum *acc = ctx->DrawBuffer->Accum + ypos * width4 + xpos * 4;
GLuint i;
- gl_read_rgba_span(ctx, ctx->DrawBuffer, width, xpos, ypos, rgba);
+ _mesa_read_rgba_span(ctx, ctx->DrawBuffer, width, xpos, ypos, rgba);
for (i=0;i<width;i++) {
*acc += (GLaccum) ( (GLfloat) rgba[i][RCOMP] * rscale ); acc++;
*acc += (GLaccum) ( (GLfloat) rgba[i][GCOMP] * gscale ); acc++;
assert(swrast->_IntegerAccumScaler <= 1.0);
for (j = 0; j < height; j++) {
GLuint i, i4;
- gl_read_rgba_span(ctx, ctx->DrawBuffer, width, xpos, ypos, rgba);
+ _mesa_read_rgba_span(ctx, ctx->DrawBuffer, width, xpos, ypos, rgba);
for (i = i4 = 0; i < width; i++, i4 += 4) {
acc[i4+0] = rgba[i][RCOMP];
acc[i4+1] = rgba[i][GCOMP];
GLuint i, j;
for (j = 0; j < height; j++) {
GLaccum *acc = ctx->DrawBuffer->Accum + ypos * width4 + xpos * 4;
- gl_read_rgba_span(ctx, ctx->DrawBuffer, width, xpos, ypos, rgba);
+ _mesa_read_rgba_span(ctx, ctx->DrawBuffer, width, xpos, ypos, rgba);
for (i=0;i<width;i++) {
*acc++ = (GLaccum) ((GLfloat) rgba[i][RCOMP] * rscale + d);
*acc++ = (GLaccum) ((GLfloat) rgba[i][GCOMP] * gscale + d);
}
(*ctx->Driver.WriteRGBASpan)( ctx, width, xpos, ypos,
(const GLchan (*)[4])rgba, NULL );
+ if (ctx->DrawBuffer->UseSoftwareAlphaBuffers
+ && ctx->Color.ColorMask[ACOMP]) {
+ _mesa_write_alpha_span(ctx, width, xpos, ypos,
+ (CONST GLubyte (*)[4]) rgba, NULL);
+ }
ypos++;
}
}
}
(*ctx->Driver.WriteRGBASpan)( ctx, width, xpos, ypos,
(const GLchan (*)[4])rgba, NULL );
+ if (ctx->DrawBuffer->UseSoftwareAlphaBuffers
+ && ctx->Color.ColorMask[ACOMP]) {
+ _mesa_write_alpha_span(ctx, width, xpos, ypos,
+ (CONST GLubyte (*)[4]) rgba, NULL);
+ }
ypos++;
}
}
break;
default:
- gl_error( ctx, GL_INVALID_ENUM, "glAccum" );
+ _mesa_error( ctx, GL_INVALID_ENUM, "glAccum" );
}
}