diff options
author | Brian Paul <[email protected]> | 2003-09-22 15:18:50 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2003-09-22 15:18:50 +0000 |
commit | 9d553944711c7dcd1027c1505d6e41f74ceb5ff0 (patch) | |
tree | c8a32553eab750b316f1ea8b5bc065a7ff277780 /src/mesa/drivers | |
parent | a13fb034cb50007051ba38b59ee9d59bead3f4ba (diff) |
apply patch #740145 from SourceForge
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r-- | src/mesa/drivers/ggi/default/linear.c | 75 | ||||
-rw-r--r-- | src/mesa/drivers/ggi/ggimesa.c | 8 | ||||
-rw-r--r-- | src/mesa/drivers/ggi/include/ggi/mesa/debug.h | 34 |
3 files changed, 49 insertions, 68 deletions
diff --git a/src/mesa/drivers/ggi/default/linear.c b/src/mesa/drivers/ggi/default/linear.c index 30f1b2c8e01..ffd0acc3d3b 100644 --- a/src/mesa/drivers/ggi/default/linear.c +++ b/src/mesa/drivers/ggi/default/linear.c @@ -51,20 +51,17 @@ void GGIwrite_ci32_span(const GLcontext *ctx, GLuint n, GLint x, GLint y, { ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx; FB_TYPE *fb; - fb = (FB_TYPE *)(LIBGGI_CURWRITE(ggi_ctx->ggi_visual) + + fb = (FB_TYPE *)((char *)LIBGGI_CURWRITE(ggi_ctx->ggi_visual) + FLIP(y)*LIBGGI_FB_W_STRIDE(ggi_ctx->ggi_visual)) + x; - if (mask) - { + if (mask) { while (n--) { if (*mask++) *fb = *ci; fb++; ci++; } - } - else - { + } else { while (n--) *fb++ = *ci++; } } @@ -74,20 +71,17 @@ void GGIwrite_ci8_span(const GLcontext *ctx, GLuint n, GLint x, GLint y, { ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx; FB_TYPE *fb; - fb = (FB_TYPE *)(LIBGGI_CURWRITE(ggi_ctx->ggi_visual) + + fb = (FB_TYPE *)((char *)LIBGGI_CURWRITE(ggi_ctx->ggi_visual) + FLIP(y)*LIBGGI_FB_W_STRIDE(ggi_ctx->ggi_visual)) + x; - if (mask) - { + if (mask) { while (n--) { if (*mask++) *fb = *ci; fb++; ci++; } - } - else - { + } else { while (n--) *fb++ = *ci++; } } @@ -98,20 +92,17 @@ void GGIwrite_rgba_span(const GLcontext *ctx, GLuint n, GLint x, GLint y, { ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx; FB_TYPE *fb; - fb = (FB_TYPE *)(LIBGGI_CURWRITE(ggi_ctx->ggi_visual) + + fb = (FB_TYPE *)((char *)LIBGGI_CURWRITE(ggi_ctx->ggi_visual) + FLIP(y)*LIBGGI_FB_W_STRIDE(ggi_ctx->ggi_visual)) + x; - if (mask) - { + if (mask) { while (n--) { if (*mask++) *fb = PACK(rgba[0]); fb++; rgba++; } - } - else - { + } else { while (n--) { *fb++ = PACK(rgba[0]); rgba++; @@ -124,20 +115,17 @@ void GGIwrite_rgb_span(const GLcontext *ctx, GLuint n, GLint x, GLint y, { ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx; FB_TYPE *fb; - fb = (FB_TYPE *)(LIBGGI_CURWRITE(ggi_ctx->ggi_visual) + + fb = (FB_TYPE *)((char *)LIBGGI_CURWRITE(ggi_ctx->ggi_visual) + FLIP(y)*LIBGGI_FB_W_STRIDE(ggi_ctx->ggi_visual)) + x; - if (mask) - { + if (mask) { while (n--) { if (*mask++) *fb = PACK(rgba[0]); fb++; rgba++; } - } - else - { + } else { while (n--) { *fb++ = PACK(rgba[0]); rgba++; @@ -151,19 +139,18 @@ void GGIwrite_mono_rgba_span(const GLcontext *ctx, GLuint n, GLint x, GLint y, { ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx; FB_TYPE *fb; - fb = (FB_TYPE *)(LIBGGI_CURWRITE(ggi_ctx->ggi_visual) + + fb = (FB_TYPE *)((char *)LIBGGI_CURWRITE(ggi_ctx->ggi_visual) + FLIP(y)*LIBGGI_FB_W_STRIDE(ggi_ctx->ggi_visual)) + x; - if (mask){ + if (mask) { while (n--){ if (*mask++) *fb = PACK(color); ++fb; } - } - else { + } else { while (n--) - *fb++ = PACK(color); + *fb++ = PACK(color); /* Alternatively we could write a potentialy faster HLine ggiSetGCForeground(ggi_ctx->ggi_visual, color); @@ -177,7 +164,7 @@ void GGIwrite_mono_ci_span(const GLcontext *ctx, GLuint n, GLint x, GLint y, { ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx; FB_TYPE *fb; - fb = (FB_TYPE *)(LIBGGI_CURWRITE(ggi_ctx->ggi_visual) + + fb = (FB_TYPE *)((char *)LIBGGI_CURWRITE(ggi_ctx->ggi_visual) + FLIP(y)*LIBGGI_FB_W_STRIDE(ggi_ctx->ggi_visual)) + x; if (mask){ @@ -186,8 +173,7 @@ void GGIwrite_mono_ci_span(const GLcontext *ctx, GLuint n, GLint x, GLint y, *fb = ci; ++fb; } - } - else { + } else { while (n--) *fb++ = ci; @@ -209,7 +195,7 @@ void GGIread_ci32_span(const GLcontext *ctx, { ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx; FB_TYPE *fb; - fb = (FB_TYPE *)(LIBGGI_CURWRITE(ggi_ctx->ggi_visual) + + fb = (FB_TYPE *)((char *)LIBGGI_CURWRITE(ggi_ctx->ggi_visual) + FLIP(y)*LIBGGI_FB_W_STRIDE(ggi_ctx->ggi_visual)) + x; while (n--) @@ -222,11 +208,10 @@ void GGIread_rgba_span(const GLcontext *ctx, ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx; FB_TYPE color; FB_TYPE *fb; - fb = (FB_TYPE *)(LIBGGI_CURWRITE(ggi_ctx->ggi_visual) + + fb = (FB_TYPE *)((char *)LIBGGI_CURWRITE(ggi_ctx->ggi_visual) + FLIP(y)*LIBGGI_FB_W_STRIDE(ggi_ctx->ggi_visual)) + x; - while (n--) - { + while (n--) { color = *fb++; rgba[0][RCOMP] = (GLubyte) (color>>(G+B))<<RS; rgba[0][GCOMP] = (GLubyte) ((color>>B)& ((1<<G)-1))<<GS; @@ -246,7 +231,7 @@ void GGIwrite_ci32_pixels(const GLcontext *ctx, { ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx; int stride = LIBGGI_FB_W_STRIDE(ggi_ctx->ggi_visual); - void *fb = LIBGGI_CURWRITE(ggi_ctx->ggi_visual); + char *fb = (char *)LIBGGI_CURWRITE(ggi_ctx->ggi_visual); while (n--) { if (*mask++){ @@ -265,7 +250,7 @@ void GGIwrite_mono_ci_pixels(const GLcontext *ctx, { ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx; int stride = LIBGGI_FB_W_STRIDE(ggi_ctx->ggi_visual); - void *fb = LIBGGI_CURWRITE(ggi_ctx->ggi_visual); + char *fb = (char *)LIBGGI_CURWRITE(ggi_ctx->ggi_visual); while (n--) { if (*mask++){ @@ -283,7 +268,7 @@ void GGIwrite_rgba_pixels(const GLcontext *ctx, { ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx; int stride = LIBGGI_FB_W_STRIDE(ggi_ctx->ggi_visual); - void *fb = LIBGGI_CURWRITE(ggi_ctx->ggi_visual); + char *fb = (char *)LIBGGI_CURWRITE(ggi_ctx->ggi_visual); while (n--) { if (*mask++){ @@ -302,7 +287,7 @@ void GGIwrite_mono_rgba_pixels(const GLcontext *ctx, { ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx; int stride = LIBGGI_FB_W_STRIDE(ggi_ctx->ggi_visual); - void *fb = LIBGGI_CURWRITE(ggi_ctx->ggi_visual); + char *fb = (char *)LIBGGI_CURWRITE(ggi_ctx->ggi_visual); while (n--) { if (*mask++){ @@ -325,7 +310,7 @@ void GGIread_ci32_pixels(const GLcontext *ctx, { ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx; int stride = LIBGGI_FB_W_STRIDE(ggi_ctx->ggi_visual); - void *fb = LIBGGI_CURWRITE(ggi_ctx->ggi_visual); + char *fb = (char *)LIBGGI_CURWRITE(ggi_ctx->ggi_visual); while (n--) { if (*mask++){ @@ -344,13 +329,11 @@ void GGIread_rgba_pixels(const GLcontext *ctx, { ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx; int stride = LIBGGI_FB_W_STRIDE(ggi_ctx->ggi_visual); - void *fb = LIBGGI_CURWRITE(ggi_ctx->ggi_visual); + char *fb = (char *)LIBGGI_CURWRITE(ggi_ctx->ggi_visual); FB_TYPE color; - while (n--) - { - if (*mask++) - { + while (n--) { + if (*mask++) { FB_TYPE *src = (FB_TYPE*)(fb + FLIP(*y)*stride) + *x; color = *src; diff --git a/src/mesa/drivers/ggi/ggimesa.c b/src/mesa/drivers/ggi/ggimesa.c index 1b75864dce0..8825c47162a 100644 --- a/src/mesa/drivers/ggi/ggimesa.c +++ b/src/mesa/drivers/ggi/ggimesa.c @@ -39,6 +39,7 @@ #include "tnl/t_context.h" #include "tnl/t_pipeline.h" #include "array_cache/acache.h" +#include "teximage.h" #include "texformat.h" #include "texstore.h" @@ -286,7 +287,7 @@ static void gl_ggiSetupPointers(GLcontext *ctx) static void get_mode_info(ggi_visual_t vis, int *r, int *g, int *b, GLboolean *rgb, GLboolean *db, int *ci) { - int i; + unsigned int i; *r = 0; *g = 0; @@ -392,7 +393,6 @@ int ggiMesaAttach(ggi_visual_t vis) int r, g, b, ci; GLboolean rgb, db; GLvisual *gl_visual; - GLframebuffer *gl_fb; /* We are creating the primary instance */ memset(LIBGGI_MESAEXT(vis), 0, sizeof(struct ggi_mesa_ext)); @@ -435,7 +435,7 @@ int ggiMesaExtendVisual(ggi_visual_t vis, GLboolean alpha_flag, get_mode_info(vis, &r, &g, &b, &rgb, &db, &ci); /* Initialize the visual with the provided information */ - _mesa_initialize_visual(&(LIBGGI_MESAEXT(vis)->mesa_visual.gl_visual), + _mesa_initialize_visual(gl_vis, rgb, db, stereo_flag, r, g, b, 0 /* FIXME */, ci, depth_size, stencil_size, @@ -456,8 +456,6 @@ ggi_mesa_context_t ggiMesaCreateContext(ggi_visual_t vis) { ggi_mesa_context_t ctx; int err; - ggi_color pal[256]; - int i; GGIMESADPRINT_CORE("ggiMesaCreateContext() called\n"); diff --git a/src/mesa/drivers/ggi/include/ggi/mesa/debug.h b/src/mesa/drivers/ggi/include/ggi/mesa/debug.h index 204d637922c..35d11624c64 100644 --- a/src/mesa/drivers/ggi/include/ggi/mesa/debug.h +++ b/src/mesa/drivers/ggi/include/ggi/mesa/debug.h @@ -1,4 +1,4 @@ -/* $Id: debug.h,v 1.4 2000/11/23 02:50:57 jtaylor Exp $ +/* $Id: debug.h,v 1.5 2003/09/22 15:18:51 brianp Exp $ ****************************************************************************** GGIMesa debugging macros @@ -68,23 +68,23 @@ __END_DECLS #ifdef __GNUC__ #ifdef DEBUG -#define GGIMESADPRINT(form,args...) if (_ggimesaDebugState) { ggDPrintf(_ggimesaDebugSync, "GGIMesa",form, ##args); } -#define GGIMESADPRINT_CORE(form,args...) if (_ggimesaDebugState & GGIMESADEBUG_CORE) { ggDPrintf(_ggimesaDebugSync,"GGIMesa",form, ##args); } -#define GGIMESADPRINT_MODE(form,args...) if (_ggimesaDebugState & GGIMESADEBUG_MODE) { ggDPrintf(_ggimesaDebugSync,"GGIMesa",form, ##args); } -#define GGIMESADPRINT_COLOR(form,args...) if (_ggimesaDebugState & GGIMESADEBUG_COLOR) { ggDPrintf(_ggimesaDebugSync,"GGIMesa",form, ##args); } -#define GGIMESADPRINT_DRAW(form,args...) if (_ggimesaDebugState & GGIMESADEBUG_DRAW) { ggDPrintf(_ggimesaDebugSync,"GGIMesa",form, ##args); } -#define GGIMESADPRINT_MISC(form,args...) if (_ggimesaDebugState & GGIMESADEBUG_MISC) { ggDPrintf(_ggimesaDebugSync,"GGIMesa",form, ##args); } -#define GGIMESADPRINT_LIBS(form,args...) if (_ggimesaDebugState & GGIMESADEBUG_LIBS) { ggDPrintf(_ggimesaDebugSync,"GGIMesa",form, ##args); } -#define GGIMESADPRINT_EVENTS(form,args...) if (_ggimesaDebugState & GGIMESADEBUG_EVENTS) { ggDPrintf(_ggimesaDebugSync,"GGIMesa",form, ##args); } +#define GGIMESADPRINT(args...) if (_ggimesaDebugState) { ggDPrintf(_ggimesaDebugSync, "GGIMesa",args); } +#define GGIMESADPRINT_CORE(args...) if (_ggimesaDebugState & GGIMESADEBUG_CORE) { ggDPrintf(_ggimesaDebugSync,"GGIMesa",args); } +#define GGIMESADPRINT_MODE(args...) if (_ggimesaDebugState & GGIMESADEBUG_MODE) { ggDPrintf(_ggimesaDebugSync,"GGIMesa",args); } +#define GGIMESADPRINT_COLOR(args...) if (_ggimesaDebugState & GGIMESADEBUG_COLOR) { ggDPrintf(_ggimesaDebugSync,"GGIMesa",args); } +#define GGIMESADPRINT_DRAW(args...) if (_ggimesaDebugState & GGIMESADEBUG_DRAW) { ggDPrintf(_ggimesaDebugSync,"GGIMesa",args); } +#define GGIMESADPRINT_MISC(args...) if (_ggimesaDebugState & GGIMESADEBUG_MISC) { ggDPrintf(_ggimesaDebugSync,"GGIMesa",args); } +#define GGIMESADPRINT_LIBS(args...) if (_ggimesaDebugState & GGIMESADEBUG_LIBS) { ggDPrintf(_ggimesaDebugSync,"GGIMesa",args); } +#define GGIMESADPRINT_EVENTS(args...) if (_ggimesaDebugState & GGIMESADEBUG_EVENTS) { ggDPrintf(_ggimesaDebugSync,"GGIMesa",args); } #else /* DEBUG */ -#define GGIMESADPRINT(form,args...) do{}while(0) -#define GGIMESADPRINT_CORE(form,args...) do{}while(0) -#define GGIMESADPRINT_MODE(form,args...) do{}while(0) -#define GGIMESADPRINT_COLOR(form,args...) do{}while(0) -#define GGIMESADPRINT_DRAW(form,args...) do{}while(0) -#define GGIMESADPRINT_MISC(form,args...) do{}while(0) -#define GGIMESADPRINT_LIBS(form,args...) do{}while(0) -#define GGIMESADPRINT_EVENTS(form,args...) do{}while(0) +#define GGIMESADPRINT(args...) do{}while(0) +#define GGIMESADPRINT_CORE(args...) do{}while(0) +#define GGIMESADPRINT_MODE(args...) do{}while(0) +#define GGIMESADPRINT_COLOR(args...) do{}while(0) +#define GGIMESADPRINT_DRAW(args...) do{}while(0) +#define GGIMESADPRINT_MISC(args...) do{}while(0) +#define GGIMESADPRINT_LIBS(args...) do{}while(0) +#define GGIMESADPRINT_EVENTS(args...) do{}while(0) #endif /* DEBUG */ #else /* __GNUC__ */ |