gallium: in clear_with_quad() check fb orientation, invert Y if needed
authorBrian <brian.paul@tungstengraphics.com>
Thu, 20 Mar 2008 20:17:06 +0000 (14:17 -0600)
committerBrian <brian.paul@tungstengraphics.com>
Thu, 20 Mar 2008 21:04:08 +0000 (15:04 -0600)
src/mesa/state_tracker/st_cb_clear.c

index dc0d87acd388413c759508755052e9a6607b3186..5ca15df602a811f9d0162b771b1bde23f537d288 100644 (file)
@@ -165,9 +165,17 @@ clear_with_quad(GLcontext *ctx,
    struct st_context *st = ctx->st;
    struct pipe_context *pipe = st->pipe;
    const GLfloat x0 = ctx->DrawBuffer->_Xmin;
-   const GLfloat y0 = ctx->DrawBuffer->_Ymin;
    const GLfloat x1 = ctx->DrawBuffer->_Xmax;
-   const GLfloat y1 = ctx->DrawBuffer->_Ymax;
+   GLfloat y0, y1;
+
+   if (st_fb_orientation(ctx->DrawBuffer) == Y_0_TOP) {
+      y0 = ctx->DrawBuffer->Height - ctx->DrawBuffer->_Ymax;
+      y1 = ctx->DrawBuffer->Height - ctx->DrawBuffer->_Ymin;
+   }
+   else {
+      y0 = ctx->DrawBuffer->_Ymin;
+      y1 = ctx->DrawBuffer->_Ymax;
+   }
 
    /*
    printf("%s %s%s%s %f,%f %f,%f\n", __FUNCTION__,