added GL_SGIX/SGIS_pixel_texture
[mesa.git] / src / mesa / main / drawpix.c
index 111bdf8b713f86e0352b1ca736fc3ece1b36e349..23479bf321f2b4d7ecd5a2fc186801212dfe26ac 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: drawpix.c,v 1.15 2000/03/21 01:03:40 brianp Exp $ */
+/* $Id: drawpix.c,v 1.17 2000/04/07 16:27:26 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
 #include "mem.h"
 #include "mmath.h"
 #include "pixel.h"
+#include "pixeltex.h"
 #include "span.h"
 #include "state.h"
 #include "stencil.h"
+#include "texture.h"
 #include "types.h"
 #include "zoom.h"
 #endif
@@ -125,6 +127,7 @@ simple_DrawPixels( GLcontext *ctx, GLint x, GLint y,
        && ctx->Pixel.AlphaBias==0.0 && ctx->Pixel.AlphaScale==1.0
        && ctx->Pixel.IndexShift==0 && ctx->Pixel.IndexOffset==0
        && ctx->Pixel.MapColorFlag==0
+       && ctx->Texture.ReallyEnabled == 0
        && unpack->Alignment==1
        && !unpack->SwapBytes
        && !unpack->LsbFirst) {
@@ -645,6 +648,17 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y,
          _mesa_unpack_ubyte_color_span(ctx, width, GL_RGBA, (void*) rgba,
                    format, type, source, unpack, GL_TRUE);
 
+         if (ctx->Texture.ReallyEnabled && ctx->Pixel.PixelTextureEnabled) {
+            GLfloat s[MAX_WIDTH], t[MAX_WIDTH], r[MAX_WIDTH], q[MAX_WIDTH];
+            GLuint unit;
+            /* XXX not sure how multitexture is supposed to work here */
+            for (unit = 0; unit < MAX_TEXTURE_UNITS; unit++) {
+               _mesa_pixeltexgen(ctx, width, (const GLubyte (*)[4]) rgba,
+                                 s, t, r, q);
+               gl_texture_pixels(ctx, unit, width, s, t, r, NULL, rgba);
+            }
+         }
+
          if (quickDraw) {
             (*ctx->Driver.WriteRGBASpan)( ctx, width, x, y,
                                           (CONST GLubyte (*)[]) rgba, NULL);
@@ -681,6 +695,8 @@ _mesa_DrawPixels( GLsizei width, GLsizei height,
       x = (GLint) (ctx->Current.RasterPos[0] + 0.5F);
       y = (GLint) (ctx->Current.RasterPos[1] + 0.5F);
 
+      ctx->OcclusionResult = GL_TRUE;
+
       /* see if device driver can do the drawpix */
       if (ctx->Driver.DrawPixels
           && (*ctx->Driver.DrawPixels)(ctx, x, y, width, height, format, type,