summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/ggi/default
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2003-09-22 15:18:50 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2003-09-22 15:18:50 +0000
commit9d553944711c7dcd1027c1505d6e41f74ceb5ff0 (patch)
treec8a32553eab750b316f1ea8b5bc065a7ff277780 /src/mesa/drivers/ggi/default
parenta13fb034cb50007051ba38b59ee9d59bead3f4ba (diff)
apply patch #740145 from SourceForge
Diffstat (limited to 'src/mesa/drivers/ggi/default')
-rw-r--r--src/mesa/drivers/ggi/default/linear.c75
1 files changed, 29 insertions, 46 deletions
diff --git a/src/mesa/drivers/ggi/default/linear.c b/src/mesa/drivers/ggi/default/linear.c
index 30f1b2c8e0..ffd0acc3d3 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;