GL_INTENSITY case was incorrect in extract_float_rgba()
[mesa.git] / src / mesa / swrast / s_bitmap.c
index f11186baedf618b525dd96a05bc2052fc8ac984b..d22579c02f38d855b2f172def88e938b17998baa 100644 (file)
@@ -1,21 +1,21 @@
-/* $Id: s_bitmap.c,v 1.2 2000/11/05 18:24:40 keithw Exp $ */
+/* $Id: s_bitmap.c,v 1.7 2001/03/19 02:25:36 keithw Exp $ */
 
 /*
  * Mesa 3-D graphics library
- * Version:  3.3
- * 
- * Copyright (C) 1999  Brian Paul   All Rights Reserved.
- * 
+ * Version:  3.5
+ *
+ * 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"),
  * to deal in the Software without restriction, including without limitation
  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  * and/or sell copies of the Software, and to permit persons to whom the
  * Software is furnished to do so, subject to the following conditions:
- * 
+ *
  * The above copyright notice and this permission notice shall be included
  * in all copies or substantial portions of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 /*
  * Render a bitmap.
  */
-void 
+void
 _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py,
                GLsizei width, GLsizei height,
                const struct gl_pixelstore_attrib *unpack,
                const GLubyte *bitmap )
 {
-   struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
+   SWcontext *swrast = SWRAST_CONTEXT(ctx);
+   struct pixel_buffer *PB = swrast->PB;
    GLint row, col;
    GLdepth fragZ;
    GLfixed fogCoord;
@@ -53,16 +54,13 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py,
    ASSERT(ctx->RenderMode == GL_RENDER);
    ASSERT(bitmap);
 
+   RENDER_START(swrast,ctx);
+
    if (SWRAST_CONTEXT(ctx)->NewState)
       _swrast_validate_derived( ctx );
 
-   if (PB->primitive != GL_BITMAP) {
-      gl_flush_pb( ctx );
-      PB->primitive = GL_BITMAP;
-   }
-
    /* Set bitmap drawing color */
-   if (ctx->Visual.RGBAflag) {
+   if (ctx->Visual.rgbMode) {
       GLint r, g, b, a;
       r = (GLint) (ctx->Current.RasterColor[0] * CHAN_MAXF);
       g = (GLint) (ctx->Current.RasterColor[1] * CHAN_MAXF);
@@ -74,8 +72,8 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py,
       PB_SET_INDEX( PB, ctx->Current.RasterIndex );
    }
 
-   fragZ = (GLdepth) ( ctx->Current.RasterPos[2] * ctx->Visual.DepthMaxF);
-    
+   fragZ = (GLdepth) ( ctx->Current.RasterPos[2] * ctx->DepthMaxF);
+
    _mesa_win_fog_coords_from_z( ctx, 1, &fragZ, &fogCoord );
 
    for (row=0; row<height; row++) {
@@ -128,8 +126,7 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py,
       }
    }
 
-   gl_flush_pb(ctx);
-}
-
-
+   _mesa_flush_pb(ctx);
 
+   RENDER_FINISH(swrast,ctx);
+}