fix up radeon span functions using latest r200 code from Brian,
[mesa.git] / src / mesa / drivers / dri / i915 / intel_pixel.c
index 6ffc33aa6b4c9547dbd4117d7bda46cea018e045..a79bed45fbe80d9e036fd3b3b2132c7912675971 100644 (file)
@@ -3,6 +3,26 @@
  * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
  * 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, sub license, 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 (including the
+ * next paragraph) 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 NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * 
  **************************************************************************/
 
 #include "glheader.h"
@@ -66,8 +86,7 @@ check_color_per_fragment_ops( const GLcontext *ctx )
                    !ctx->Color.ColorMask[2] ||
                    !ctx->Color.ColorMask[3] ||
                    ctx->Color.ColorLogicOpEnabled ||
-                   ctx->Texture._EnabledUnits ||
-                   ctx->Depth.OcclusionTest
+                   ctx->Texture._EnabledUnits
            ) &&
           ctx->Current.RasterPosValid);
    
@@ -111,7 +130,7 @@ clip_pixelrect( const GLcontext *ctx,
    if (*height <= 0)
       return GL_FALSE;
 
-   *size = ((*y + *height - 1) * intel->intelScreen->frontPitch +
+   *size = ((*y + *height - 1) * intel->intelScreen->front.pitch +
            (*x + *width - 1) * intel->intelScreen->cpp);
 
    return GL_TRUE;
@@ -125,7 +144,7 @@ intelTryReadPixels( GLcontext *ctx,
                  GLvoid *pixels )
 {
    intelContextPtr intel = INTEL_CONTEXT(ctx);
-   GLint size;
+   GLint size = 0;
    GLint pitch = pack->RowLength ? pack->RowLength : width;
 
    if (INTEL_DEBUG & DEBUG_PIXEL)
@@ -174,7 +193,7 @@ intelTryReadPixels( GLcontext *ctx,
       __DRIdrawablePrivate *dPriv = intel->driDrawable;
       int nbox = dPriv->numClipRects;
       int src_offset = intel->drawOffset;
-      int src_pitch = intel->intelScreen->frontPitch;
+      int src_pitch = intel->intelScreen->front.pitch;
       int dst_offset = intelAgpOffsetFromVirtual( intel, pixels);
       drm_clip_rect_t *box = dPriv->pClipRects;
       int i;
@@ -266,6 +285,7 @@ static void do_draw_pix( GLcontext *ctx,
 
    intelFlush( &intel->ctx );
    LOCK_HARDWARE( intel );
+   if (ctx->DrawBuffer)
    {
       y -= height;                     /* cope with pixel zoom */
    
@@ -298,7 +318,7 @@ static void do_draw_pix( GLcontext *ctx,
         intelEmitCopyBlitLocked( intel,
                            intel->intelScreen->cpp,
                            src_pitch, src_offset,
-                           intel->intelScreen->frontPitch,
+                           intel->intelScreen->front.pitch,
                              intel->drawOffset,
                            bx - x, by - y,
                            bx, by,