-/* $Id: s_alphabuf.c,v 1.11 2002/07/09 01:22:52 brianp Exp $ */
-
/*
* Mesa 3-D graphics library
- * Version: 4.0.2
+ * Version: 6.1
*
- * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2004 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 "glheader.h"
+#include "colormac.h"
#include "context.h"
-#include "mem.h"
+#include "imports.h"
+#include "s_context.h"
#include "s_alphabuf.h"
* Allocate a new front and back alpha buffer.
*/
void
-_mesa_alloc_alpha_buffers( GLframebuffer *buffer )
+_swrast_alloc_alpha_buffers( GLframebuffer *buffer )
{
const GLint bytes = buffer->Width * buffer->Height * sizeof(GLchan);
* Clear all the alpha buffers
*/
void
-_mesa_clear_alpha_buffers( GLcontext *ctx )
+_swrast_clear_alpha_buffers( GLcontext *ctx )
{
- const GLchan aclear = ctx->Color.ClearColor[3];
+ GLchan aclear;
GLuint bufferBit;
+ CLAMPED_FLOAT_TO_CHAN(aclear, ctx->Color.ClearColor[3]);
+
ASSERT(ctx->DrawBuffer->UseSoftwareAlphaBuffers);
ASSERT(ctx->Color.ColorMask[ACOMP]);
static INLINE
GLchan *get_alpha_buffer( GLcontext *ctx )
{
- switch (ctx->Color._DriverDrawBuffer) {
- case GL_FRONT_LEFT:
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
+
+ switch (swrast->CurrentBuffer) {
+ case FRONT_LEFT_BIT:
return ctx->DrawBuffer->FrontLeftAlpha;
break;
- case GL_BACK_LEFT:
+ case BACK_LEFT_BIT:
return ctx->DrawBuffer->BackLeftAlpha;
break;
- case GL_FRONT_RIGHT:
+ case FRONT_RIGHT_BIT:
return ctx->DrawBuffer->FrontRightAlpha;
break;
- case GL_BACK_RIGHT:
+ case BACK_RIGHT_BIT:
return ctx->DrawBuffer->BackRightAlpha;
break;
default:
- _mesa_problem(ctx, "Bad DriverDrawBuffer in _mesa_write_alpha_span()");
- return ctx->DrawBuffer->FrontLeftAlpha; /* aribitrary */
+ _mesa_problem(ctx, "Bad CurrentBuffer in get_alpha_buffer()");
+ return (GLchan *) ctx->DrawBuffer->FrontLeftAlpha;
}
}
void
-_mesa_write_alpha_span( GLcontext *ctx, GLuint n, GLint x, GLint y,
+_swrast_write_alpha_span( GLcontext *ctx, GLuint n, GLint x, GLint y,
CONST GLchan rgba[][4], const GLubyte mask[] )
{
GLchan *buffer, *aptr;
void
-_mesa_write_mono_alpha_span( GLcontext *ctx, GLuint n, GLint x, GLint y,
+_swrast_write_mono_alpha_span( GLcontext *ctx, GLuint n, GLint x, GLint y,
GLchan alpha, const GLubyte mask[] )
{
GLchan *buffer, *aptr;
void
-_mesa_write_alpha_pixels( GLcontext *ctx,
+_swrast_write_alpha_pixels( GLcontext *ctx,
GLuint n, const GLint x[], const GLint y[],
CONST GLchan rgba[][4], const GLubyte mask[] )
{
void
-_mesa_write_mono_alpha_pixels( GLcontext *ctx,
+_swrast_write_mono_alpha_pixels( GLcontext *ctx,
GLuint n, const GLint x[], const GLint y[],
GLchan alpha, const GLubyte mask[] )
{
void
-_mesa_read_alpha_span( GLcontext *ctx,
+_swrast_read_alpha_span( GLcontext *ctx,
GLuint n, GLint x, GLint y, GLchan rgba[][4] )
{
const GLchan *buffer, *aptr;
void
-_mesa_read_alpha_pixels( GLcontext *ctx,
+_swrast_read_alpha_pixels( GLcontext *ctx,
GLuint n, const GLint x[], const GLint y[],
GLchan rgba[][4], const GLubyte mask[] )
{