fixed inverted Y coord for dithering in write_span_DITHER_5R6G5B_ximage()
authorBrian Paul <brian.paul@tungstengraphics.com>
Mon, 29 Jan 2001 22:40:23 +0000 (22:40 +0000)
committerBrian Paul <brian.paul@tungstengraphics.com>
Mon, 29 Jan 2001 22:40:23 +0000 (22:40 +0000)
src/mesa/drivers/x11/xm_span.c

index 623762f..714fcaf 100644 (file)
@@ -1,10 +1,10 @@
-/* $Id: xm_span.c,v 1.6 2001/01/24 00:04:59 brianp Exp $ */
+/* $Id: xm_span.c,v 1.7 2001/01/29 22:40:23 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"),
@@ -1507,10 +1507,11 @@ static void write_span_DITHER_5R6G5B_ximage( RGBA_SPAN_ARGS )
    const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
    register GLuint i;
    register GLushort *ptr = PIXELADDR2( xmesa->xm_buffer, x, y );
+   const GLint y2 = FLIP(xmesa->xm_buffer, y);
    if (mask) {
       for (i=0;i<n;i++,x++) {
          if (mask[i]) {
-            PACK_TRUEDITHER( ptr[i], x, y, rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP] );
+            PACK_TRUEDITHER( ptr[i], x, y2, rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP] );
          }
       }
    }
@@ -1522,16 +1523,16 @@ static void write_span_DITHER_5R6G5B_ximage( RGBA_SPAN_ARGS )
       n -= extraPixel;
       for (i = 0; i < n; i += 2, x += 2) {
          GLuint p0, p1;
-         PACK_TRUEDITHER( p0, x, y, rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP] );
-         PACK_TRUEDITHER( p1, x+1, y, rgba[i+1][RCOMP], rgba[i+1][GCOMP], rgba[i+1][BCOMP] );
+         PACK_TRUEDITHER( p0, x, y2, rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP] );
+         PACK_TRUEDITHER( p1, x+1, y2, rgba[i+1][RCOMP], rgba[i+1][GCOMP], rgba[i+1][BCOMP] );
          *ptr32++ = (p1 << 16) | p0;
       }
       if (extraPixel) {
-         PACK_TRUEDITHER( ptr[n], x+n, y, rgba[n][RCOMP], rgba[n][GCOMP], rgba[n][BCOMP]);
+         PACK_TRUEDITHER( ptr[n], x+n, y2, rgba[n][RCOMP], rgba[n][GCOMP], rgba[n][BCOMP]);
       }
 #else
       for (i = 0; i < n; i++, x++) {
-         PACK_TRUEDITHER( ptr[i], x, y, rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP]);
+         PACK_TRUEDITHER( ptr[i], x, y2, rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP]);
       }
 #endif
    }