summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2009-11-05 16:48:50 -0700
committerBrian Paul <[email protected]>2009-11-05 16:48:52 -0700
commit63191bd244f18fd78bebb9586d2b85ab9d5b38e2 (patch)
treee7e7c3f44cd4d2d6391e349b3da8c95f9b763dc0 /src/mesa
parent7c623905bc032480a0765093825f3bd105345121 (diff)
xmesa: pass pixmap to clip_for_xgetimage()
The code was assuming ctx->DrawBuffer == ctx->ReadBuffer. Passing the pixmap is simpler and better. Fixes a potential segfault.
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/x11/xm_span.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/mesa/drivers/x11/xm_span.c b/src/mesa/drivers/x11/xm_span.c
index 309cefcb8e8..c39d87c4516 100644
--- a/src/mesa/drivers/x11/xm_span.c
+++ b/src/mesa/drivers/x11/xm_span.c
@@ -3773,7 +3773,7 @@ static void put_values_ci_ximage( PUT_VALUES_ARGS )
* else return number of pixels to skip in the destination array.
*/
static int
-clip_for_xgetimage(GLcontext *ctx, GLuint *n, GLint *x, GLint *y)
+clip_for_xgetimage(GLcontext *ctx, XMesaPixmap pixmap, GLuint *n, GLint *x, GLint *y)
{
XMesaContext xmesa = XMESA_CONTEXT(ctx);
XMesaBuffer source = XMESA_BUFFER(ctx->DrawBuffer);
@@ -3783,7 +3783,7 @@ clip_for_xgetimage(GLcontext *ctx, GLuint *n, GLint *x, GLint *y)
GLint dx, dy;
if (source->type == PBUFFER || source->type == PIXMAP)
return 0;
- XTranslateCoordinates(xmesa->display, source->frontxrb->pixmap, rootWin,
+ XTranslateCoordinates(xmesa->display, pixmap, rootWin,
*x, *y, &dx, &dy, &child);
if (dx >= screenWidth) {
/* totally clipped on right */
@@ -3827,7 +3827,7 @@ get_row_ci(GLcontext *ctx, struct gl_renderbuffer *rb,
#ifndef XFree86Server
XMesaImage *span = NULL;
int error;
- int k = clip_for_xgetimage(ctx, &n, &x, &y);
+ int k = clip_for_xgetimage(ctx, xrb->pixmap, &n, &x, &y);
if (k < 0)
return;
index += k;
@@ -3892,7 +3892,7 @@ get_row_rgba(GLcontext *ctx, struct gl_renderbuffer *rb,
#else
int k;
y = YFLIP(xrb, y);
- k = clip_for_xgetimage(ctx, &n, &x, &y);
+ k = clip_for_xgetimage(ctx, xrb->pixmap, &n, &x, &y);
if (k < 0)
return;
rgba += k;