more Driver.Color, Driver.Index updates

This commit is contained in:
Brian Paul
2000-11-14 17:51:15 +00:00
parent f930330d5f
commit 4fae0260a6
2 changed files with 54 additions and 58 deletions

View File

@@ -1,4 +1,4 @@
/* $Id: GLView.cpp,v 1.3 2000/09/26 20:54:09 brianp Exp $ */ /* $Id: GLView.cpp,v 1.4 2000/11/14 17:51:15 brianp Exp $ */
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
@@ -27,6 +27,9 @@
/* /*
* $Log: GLView.cpp,v $ * $Log: GLView.cpp,v $
* Revision 1.4 2000/11/14 17:51:15 brianp
* more Driver.Color, Driver.Index updates
*
* Revision 1.3 2000/09/26 20:54:09 brianp * Revision 1.3 2000/09/26 20:54:09 brianp
* First batch of OpenGL SI related changes: * First batch of OpenGL SI related changes:
* Renamed struct gl_context to struct __GLcontextRec. * Renamed struct gl_context to struct __GLcontextRec.
@@ -105,8 +108,6 @@ private:
BGLView *mBGLView; BGLView *mBGLView;
BBitmap *mBitmap; BBitmap *mBitmap;
GLubyte mColor[4]; // current color
GLuint mIndex; // current color index
GLubyte mClearColor[4]; // buffer clear color GLubyte mClearColor[4]; // buffer clear color
GLuint mClearIndex; // buffer clear color index GLuint mClearIndex; // buffer clear color index
GLint mBottom; // used for flipping Y coords GLint mBottom; // used for flipping Y coords
@@ -144,13 +145,16 @@ private:
CONST GLubyte rgba[][3], CONST GLubyte rgba[][3],
const GLubyte mask[]); const GLubyte mask[]);
static void WriteMonoRGBASpanFront(const GLcontext *ctx, GLuint n, static void WriteMonoRGBASpanFront(const GLcontext *ctx, GLuint n,
GLint x, GLint y, const GLubyte mask[]); GLint x, GLint y,
const GLchan color[4],
const GLubyte mask[]);
static void WriteRGBAPixelsFront(const GLcontext *ctx, GLuint n, static void WriteRGBAPixelsFront(const GLcontext *ctx, GLuint n,
const GLint x[], const GLint y[], const GLint x[], const GLint y[],
CONST GLubyte rgba[][4], CONST GLubyte rgba[][4],
const GLubyte mask[]); const GLubyte mask[]);
static void WriteMonoRGBAPixelsFront(const GLcontext *ctx, GLuint n, static void WriteMonoRGBAPixelsFront(const GLcontext *ctx, GLuint n,
const GLint x[], const GLint y[], const GLint x[], const GLint y[],
const GLchan color[4],
const GLubyte mask[]); const GLubyte mask[]);
static void WriteCI32SpanFront(const GLcontext *ctx, GLuint n, static void WriteCI32SpanFront(const GLcontext *ctx, GLuint n,
GLint x, GLint y, GLint x, GLint y,
@@ -159,13 +163,14 @@ private:
GLint x, GLint y, GLint x, GLint y,
const GLubyte index[], const GLubyte mask[]); const GLubyte index[], const GLubyte mask[]);
static void WriteMonoCISpanFront(const GLcontext *ctx, GLuint n, static void WriteMonoCISpanFront(const GLcontext *ctx, GLuint n,
GLint x, GLint y, const GLubyte mask[]); GLint x, GLint y,
GLuint colorIndex, const GLubyte mask[]);
static void WriteCI32PixelsFront(const GLcontext *ctx, static void WriteCI32PixelsFront(const GLcontext *ctx,
GLuint n, const GLint x[], const GLint y[], GLuint n, const GLint x[], const GLint y[],
const GLuint index[], const GLubyte mask[]); const GLuint index[], const GLubyte mask[]);
static void WriteMonoCIPixelsFront(const GLcontext *ctx, GLuint n, static void WriteMonoCIPixelsFront(const GLcontext *ctx, GLuint n,
const GLint x[], const GLint y[], const GLint x[], const GLint y[],
const GLubyte mask[]); GLuint colorIndex, const GLubyte mask[]);
static void ReadCI32SpanFront(const GLcontext *ctx, static void ReadCI32SpanFront(const GLcontext *ctx,
GLuint n, GLint x, GLint y, GLuint index[]); GLuint n, GLint x, GLint y, GLuint index[]);
static void ReadRGBASpanFront(const GLcontext *ctx, GLuint n, static void ReadRGBASpanFront(const GLcontext *ctx, GLuint n,
@@ -188,13 +193,16 @@ private:
CONST GLubyte rgba[][3], CONST GLubyte rgba[][3],
const GLubyte mask[]); const GLubyte mask[]);
static void WriteMonoRGBASpanBack(const GLcontext *ctx, GLuint n, static void WriteMonoRGBASpanBack(const GLcontext *ctx, GLuint n,
GLint x, GLint y, const GLubyte mask[]); GLint x, GLint y,
const GLchan color[4],
const GLubyte mask[]);
static void WriteRGBAPixelsBack(const GLcontext *ctx, GLuint n, static void WriteRGBAPixelsBack(const GLcontext *ctx, GLuint n,
const GLint x[], const GLint y[], const GLint x[], const GLint y[],
CONST GLubyte rgba[][4], CONST GLubyte rgba[][4],
const GLubyte mask[]); const GLubyte mask[]);
static void WriteMonoRGBAPixelsBack(const GLcontext *ctx, GLuint n, static void WriteMonoRGBAPixelsBack(const GLcontext *ctx, GLuint n,
const GLint x[], const GLint y[], const GLint x[], const GLint y[],
const GLchan color[4],
const GLubyte mask[]); const GLubyte mask[]);
static void WriteCI32SpanBack(const GLcontext *ctx, GLuint n, static void WriteCI32SpanBack(const GLcontext *ctx, GLuint n,
GLint x, GLint y, GLint x, GLint y,
@@ -202,14 +210,14 @@ private:
static void WriteCI8SpanBack(const GLcontext *ctx, GLuint n, GLint x, GLint y, static void WriteCI8SpanBack(const GLcontext *ctx, GLuint n, GLint x, GLint y,
const GLubyte index[], const GLubyte mask[]); const GLubyte index[], const GLubyte mask[]);
static void WriteMonoCISpanBack(const GLcontext *ctx, GLuint n, static void WriteMonoCISpanBack(const GLcontext *ctx, GLuint n,
GLint x, GLint y, GLint x, GLint y, GLuint colorIndex,
const GLubyte mask[]); const GLubyte mask[]);
static void WriteCI32PixelsBack(const GLcontext *ctx, static void WriteCI32PixelsBack(const GLcontext *ctx,
GLuint n, const GLint x[], const GLint y[], GLuint n, const GLint x[], const GLint y[],
const GLuint index[], const GLubyte mask[]); const GLuint index[], const GLubyte mask[]);
static void WriteMonoCIPixelsBack(const GLcontext *ctx, static void WriteMonoCIPixelsBack(const GLcontext *ctx,
GLuint n, const GLint x[], const GLint y[], GLuint n, const GLint x[], const GLint y[],
const GLubyte mask[]); GLuint colorIndex, const GLubyte mask[]);
static void ReadCI32SpanBack(const GLcontext *ctx, static void ReadCI32SpanBack(const GLcontext *ctx,
GLuint n, GLint x, GLint y, GLuint index[]); GLuint n, GLint x, GLint y, GLuint index[]);
static void ReadRGBASpanBack(const GLcontext *ctx, GLuint n, static void ReadRGBASpanBack(const GLcontext *ctx, GLuint n,
@@ -238,11 +246,6 @@ AuxInfo::AuxInfo()
mClearColor[BE_BCOMP] = 0; mClearColor[BE_BCOMP] = 0;
mClearColor[BE_ACOMP] = 0; mClearColor[BE_ACOMP] = 0;
mClearIndex = 0; mClearIndex = 0;
mColor[BE_RCOMP] = 255;
mColor[BE_GCOMP] = 255;
mColor[BE_BCOMP] = 255;
mColor[BE_ACOMP] = 255;
mIndex = 1;
} }
@@ -304,8 +307,6 @@ void AuxInfo::UpdateState( GLcontext *ctx )
ctx->Driver.UpdateState = AuxInfo::UpdateState; ctx->Driver.UpdateState = AuxInfo::UpdateState;
ctx->Driver.SetDrawBuffer = AuxInfo::SetDrawBuffer; ctx->Driver.SetDrawBuffer = AuxInfo::SetDrawBuffer;
ctx->Driver.SetReadBuffer = AuxInfo::SetReadBuffer; ctx->Driver.SetReadBuffer = AuxInfo::SetReadBuffer;
ctx->Driver.Color = AuxInfo::Color;
ctx->Driver.Index = AuxInfo::Index;
ctx->Driver.ClearIndex = AuxInfo::ClearIndex; ctx->Driver.ClearIndex = AuxInfo::ClearIndex;
ctx->Driver.ClearColor = AuxInfo::ClearColor; ctx->Driver.ClearColor = AuxInfo::ClearColor;
ctx->Driver.GetBufferSize = AuxInfo::GetBufferSize; ctx->Driver.GetBufferSize = AuxInfo::GetBufferSize;
@@ -411,6 +412,7 @@ void AuxInfo::ClearFront(GLcontext *ctx,
} }
// restore drawing color // restore drawing color
#if 0
bglview->SetHighColor(aux->mColor[BE_RCOMP], bglview->SetHighColor(aux->mColor[BE_RCOMP],
aux->mColor[BE_GCOMP], aux->mColor[BE_GCOMP],
aux->mColor[BE_BCOMP], aux->mColor[BE_BCOMP],
@@ -419,6 +421,7 @@ void AuxInfo::ClearFront(GLcontext *ctx,
aux->mColor[BE_GCOMP], aux->mColor[BE_GCOMP],
aux->mColor[BE_BCOMP], aux->mColor[BE_BCOMP],
aux->mColor[BE_ACOMP]); aux->mColor[BE_ACOMP]);
#endif
} }
@@ -459,29 +462,6 @@ void AuxInfo::ClearBack(GLcontext *ctx,
} }
void AuxInfo::Index(GLcontext *ctx, GLuint index)
{
AuxInfo *aux = (AuxInfo *) ctx->DriverCtx;
BGLView *bglview = aux->mBGLView;
assert(bglview);
aux->mIndex = index;
}
void AuxInfo::Color(GLcontext *ctx, GLubyte r, GLubyte g,
GLubyte b, GLubyte a)
{
AuxInfo *aux = (AuxInfo *) ctx->DriverCtx;
BGLView *bglview = aux->mBGLView;
assert(bglview);
aux->mColor[BE_RCOMP] = r;
aux->mColor[BE_GCOMP] = g;
aux->mColor[BE_BCOMP] = b;
aux->mColor[BE_ACOMP] = a;
bglview->SetHighColor(r, g, b, a);
bglview->SetLowColor(r, g, b, a);
}
GLboolean AuxInfo::SetDrawBuffer(GLcontext *ctx, GLenum buffer) GLboolean AuxInfo::SetDrawBuffer(GLcontext *ctx, GLenum buffer)
{ {
if (buffer == GL_FRONT_LEFT) if (buffer == GL_FRONT_LEFT)
@@ -601,12 +581,15 @@ void AuxInfo::WriteRGBSpanFront(const GLcontext *ctx, GLuint n,
} }
void AuxInfo::WriteMonoRGBASpanFront(const GLcontext *ctx, GLuint n, void AuxInfo::WriteMonoRGBASpanFront(const GLcontext *ctx, GLuint n,
GLint x, GLint y, const GLubyte mask[]) GLint x, GLint y,
const GLchan color[4],
const GLubyte mask[])
{ {
AuxInfo *aux = (AuxInfo *) ctx->DriverCtx; AuxInfo *aux = (AuxInfo *) ctx->DriverCtx;
BGLView *bglview = aux->mBGLView; BGLView *bglview = aux->mBGLView;
assert(bglview); assert(bglview);
int flippedY = aux->mBottom - y; int flippedY = aux->mBottom - y;
bglview->SetHighColor(color[RCOMP], color[GCOMP], color[BCOMP]);
if (mask) { if (mask) {
for (GLuint i = 0; i < n; i++) { for (GLuint i = 0; i < n; i++) {
if (mask[i]) { if (mask[i]) {
@@ -648,12 +631,14 @@ void AuxInfo::WriteRGBAPixelsFront(const GLcontext *ctx,
void AuxInfo::WriteMonoRGBAPixelsFront(const GLcontext *ctx, GLuint n, void AuxInfo::WriteMonoRGBAPixelsFront(const GLcontext *ctx, GLuint n,
const GLint x[], const GLint y[], const GLint x[], const GLint y[],
const GLchan color[4],
const GLubyte mask[]) const GLubyte mask[])
{ {
AuxInfo *aux = (AuxInfo *) ctx->DriverCtx; AuxInfo *aux = (AuxInfo *) ctx->DriverCtx;
BGLView *bglview = aux->mBGLView; BGLView *bglview = aux->mBGLView;
assert(bglview); assert(bglview);
// plot points using current color // plot points using current color
bglview->SetHighColor(color[RCOMP], color[GCOMP], color[BCOMP]);
if (mask) { if (mask) {
for (GLuint i = 0; i < n; i++) { for (GLuint i = 0; i < n; i++) {
if (mask[i]) { if (mask[i]) {
@@ -682,7 +667,8 @@ void AuxInfo::WriteCI8SpanFront( const GLcontext *ctx, GLuint n, GLint x, GLint
} }
void AuxInfo::WriteMonoCISpanFront( const GLcontext *ctx, GLuint n, void AuxInfo::WriteMonoCISpanFront( const GLcontext *ctx, GLuint n,
GLint x, GLint y, const GLubyte mask[] ) GLint x, GLint y,
GLuint colorIndex, const GLubyte mask[] )
{ {
// XXX to do // XXX to do
} }
@@ -697,7 +683,7 @@ void AuxInfo::WriteCI32PixelsFront( const GLcontext *ctx, GLuint n,
void AuxInfo::WriteMonoCIPixelsFront( const GLcontext *ctx, GLuint n, void AuxInfo::WriteMonoCIPixelsFront( const GLcontext *ctx, GLuint n,
const GLint x[], const GLint y[], const GLint x[], const GLint y[],
const GLubyte mask[] ) GLuint colorIndex, const GLubyte mask[] )
{ {
// XXX to do // XXX to do
} }
@@ -802,14 +788,20 @@ void AuxInfo::WriteRGBSpanBack(const GLcontext *ctx, GLuint n,
void AuxInfo::WriteMonoRGBASpanBack(const GLcontext *ctx, GLuint n, void AuxInfo::WriteMonoRGBASpanBack(const GLcontext *ctx, GLuint n,
GLint x, GLint y, const GLubyte mask[]) GLint x, GLint y,
const GLchan color[4], const GLubyte mask[])
{ {
AuxInfo *aux = (AuxInfo *) ctx->DriverCtx; AuxInfo *aux = (AuxInfo *) ctx->DriverCtx;
BBitmap *bitmap = aux->mBitmap; BBitmap *bitmap = aux->mBitmap;
assert(bitmap); assert(bitmap);
int row = aux->mBottom - y; int row = aux->mBottom - y;
GLuint *pixelPtr = (GLuint *) bitmap->Bits() + row * aux->mWidth + x; GLuint *pixelPtr = (GLuint *) bitmap->Bits() + row * aux->mWidth + x;
const GLuint pixel = *((GLuint *) aux->mColor); GLuint pixel;
GLubyte *mColor= (GLubyte *) &pixel;
mColor[BE_RCOMP] = color[RCOMP];
mColor[BE_GCOMP] = color[GCOMP];
mColor[BE_BCOMP] = color[BCOMP];
mColor[BE_ACOMP] = color[ACOMP];
if (mask) { if (mask) {
for (GLuint i = 0; i < n; i++) { for (GLuint i = 0; i < n; i++) {
if (mask[i]) if (mask[i])
@@ -860,12 +852,18 @@ void AuxInfo::WriteRGBAPixelsBack(const GLcontext *ctx,
void AuxInfo::WriteMonoRGBAPixelsBack(const GLcontext *ctx, GLuint n, void AuxInfo::WriteMonoRGBAPixelsBack(const GLcontext *ctx, GLuint n,
const GLint x[], const GLint y[], const GLint x[], const GLint y[],
const GLchan color[4],
const GLubyte mask[]) const GLubyte mask[])
{ {
AuxInfo *aux = (AuxInfo *) ctx->DriverCtx; AuxInfo *aux = (AuxInfo *) ctx->DriverCtx;
BBitmap *bitmap = aux->mBitmap; BBitmap *bitmap = aux->mBitmap;
GLuint pixel;
GLubyte *mColor= (GLubyte *) &pixel;
mColor[BE_RCOMP] = color[RCOMP];
mColor[BE_GCOMP] = color[GCOMP];
mColor[BE_BCOMP] = color[BCOMP];
mColor[BE_ACOMP] = color[ACOMP];
assert(bitmap); assert(bitmap);
const GLuint pixel = *((GLuint *) aux->mColor);
if (mask) { if (mask) {
for (GLuint i = 0; i < n; i++) { for (GLuint i = 0; i < n; i++) {
if (mask[i]) { if (mask[i]) {
@@ -900,7 +898,8 @@ void AuxInfo::WriteCI8SpanBack( const GLcontext *ctx, GLuint n,
} }
void AuxInfo::WriteMonoCISpanBack( const GLcontext *ctx, GLuint n, void AuxInfo::WriteMonoCISpanBack( const GLcontext *ctx, GLuint n,
GLint x, GLint y, const GLubyte mask[] ) GLint x, GLint y,
GLuint colorIndex, const GLubyte mask[] )
{ {
// XXX to do // XXX to do
} }
@@ -915,7 +914,7 @@ void AuxInfo::WriteCI32PixelsBack( const GLcontext *ctx, GLuint n,
void AuxInfo::WriteMonoCIPixelsBack( const GLcontext *ctx, GLuint n, void AuxInfo::WriteMonoCIPixelsBack( const GLcontext *ctx, GLuint n,
const GLint x[], const GLint y[], const GLint x[], const GLint y[],
const GLubyte mask[] ) GLuint colorIndex, const GLubyte mask[] )
{ {
// XXX to do // XXX to do
} }

View File

@@ -1,4 +1,4 @@
/* $Id: svgapix.h,v 1.3 2000/01/25 00:03:02 brianp Exp $ */ /* $Id: svgapix.h,v 1.4 2000/11/14 17:51:15 brianp Exp $ */
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
@@ -40,10 +40,7 @@ struct svgamesa_context {
GLcontext *gl_ctx; /* the core Mesa context */ GLcontext *gl_ctx; /* the core Mesa context */
GLvisual *gl_vis; /* describes the color buffer */ GLvisual *gl_vis; /* describes the color buffer */
GLframebuffer *gl_buffer; /* the ancillary buffers */ GLframebuffer *gl_buffer; /* the ancillary buffers */
GLuint index; /* current color index */
GLuint clear_index; /* current clear index */ GLuint clear_index; /* current clear index */
GLint red, green, blue; /* current rgb color */
GLuint truecolor; /* current rgb color */
GLint clear_red, GLint clear_red,
clear_green, clear_green,
clear_blue; /* current clear rgb color */ clear_blue; /* current clear rgb color */