diff options
author | Brian Paul <brian.paul@tungstengraphics.com> | 2006-03-24 22:03:22 +0000 |
---|---|---|
committer | Brian Paul <brian.paul@tungstengraphics.com> | 2006-03-24 22:03:22 +0000 |
commit | 65f1cf2cbf5ea7c4ce45b3f894e49dbddf1892fb (patch) | |
tree | 7cca5e693afedf70e18a5bc36fe4cc52d8cb6ed3 | |
parent | f04f5e990a98365b63454a8fa708d9165cf8bb27 (diff) |
update i915/i830Scissor to use DrawBuffer instead of driDrawable bounds
-rw-r--r-- | src/mesa/drivers/dri/i915/i830_state.c | 19 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i915/i915_state.c | 19 |
2 files changed, 12 insertions, 26 deletions
diff --git a/src/mesa/drivers/dri/i915/i830_state.c b/src/mesa/drivers/dri/i915/i830_state.c index 4932635640..c804792703 100644 --- a/src/mesa/drivers/dri/i915/i830_state.c +++ b/src/mesa/drivers/dri/i915/i830_state.c @@ -498,14 +498,13 @@ static void i830Scissor(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h) { struct i830_context *i830 = i830_context(ctx); - intelScreenPrivate *screen = i830->intel.intelScreen; int x1, y1, x2, y2; - if (!i830->intel.driDrawable) + if (!ctx->DrawBuffer) return; x1 = x; - y1 = i830->intel.driDrawable->h - (y + h); + y1 = ctx->DrawBuffer->Height - (y + h); x2 = x + w - 1; y2 = y1 + h - 1; @@ -513,16 +512,10 @@ static void i830Scissor(GLcontext *ctx, GLint x, GLint y, fprintf(stderr, "[%s] x(%d) y(%d) w(%d) h(%d)\n", __FUNCTION__, x, y, w, h); - if (x1 < 0) x1 = 0; - if (y1 < 0) y1 = 0; - if (x2 < 0) x2 = 0; - if (y2 < 0) y2 = 0; - - if (x2 >= screen->width) x2 = screen->width-1; - if (y2 >= screen->height) y2 = screen->height-1; - if (x1 >= screen->width) x1 = screen->width-1; - if (y1 >= screen->height) y1 = screen->height-1; - + x1 = CLAMP(x1, 0, ctx->DrawBuffer->Width - 1); + y1 = CLAMP(y1, 0, ctx->DrawBuffer->Height - 1); + x2 = CLAMP(x2, 0, ctx->DrawBuffer->Width - 1); + y2 = CLAMP(y2, 0, ctx->DrawBuffer->Height - 1); I830_STATECHANGE(i830, I830_UPLOAD_BUFFERS); i830->state.Buffer[I830_DESTREG_SR1] = (y1 << 16) | (x1 & 0xffff); diff --git a/src/mesa/drivers/dri/i915/i915_state.c b/src/mesa/drivers/dri/i915/i915_state.c index 8f127425a7..d50d2f31ce 100644 --- a/src/mesa/drivers/dri/i915/i915_state.c +++ b/src/mesa/drivers/dri/i915/i915_state.c @@ -350,14 +350,13 @@ static void i915Scissor(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h) { struct i915_context *i915 = I915_CONTEXT(ctx); - intelScreenPrivate *screen = i915->intel.intelScreen; int x1, y1, x2, y2; - if (!i915->intel.driDrawable) + if (!ctx->DrawBuffer) return; x1 = x; - y1 = i915->intel.driDrawable->h - (y + h); + y1 = ctx->DrawBuffer->Height - (y + h); x2 = x + w - 1; y2 = y1 + h - 1; @@ -365,16 +364,10 @@ static void i915Scissor(GLcontext *ctx, GLint x, GLint y, fprintf(stderr, "[%s] x(%d) y(%d) w(%d) h(%d)\n", __FUNCTION__, x, y, w, h); - if (x1 < 0) x1 = 0; - if (y1 < 0) y1 = 0; - if (x2 < 0) x2 = 0; - if (y2 < 0) y2 = 0; - - if (x2 >= screen->width) x2 = screen->width-1; - if (y2 >= screen->height) y2 = screen->height-1; - if (x1 >= screen->width) x1 = screen->width-1; - if (y1 >= screen->height) y1 = screen->height-1; - + x1 = CLAMP(x1, 0, ctx->DrawBuffer->Width - 1); + y1 = CLAMP(y1, 0, ctx->DrawBuffer->Height - 1); + x2 = CLAMP(x2, 0, ctx->DrawBuffer->Width - 1); + y2 = CLAMP(y2, 0, ctx->DrawBuffer->Height - 1); I915_STATECHANGE(i915, I915_UPLOAD_BUFFERS); i915->state.Buffer[I915_DESTREG_SR1] = (y1 << 16) | (x1 & 0xffff); |