summaryrefslogtreecommitdiff
path: root/src/gallium/winsys
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2008-09-03 11:44:14 -0600
committerBrian Paul <brian.paul@tungstengraphics.com>2008-09-03 13:35:06 -0600
commit6ebf712d88e7d1da949e224b93ff12ef601f2742 (patch)
treed5239a78c3eb9b25e71d3b164054811d35242027 /src/gallium/winsys
parent8b8952aa69bbaa0f87526cd08aaca7659595a675 (diff)
gallium: do image clipping in xmesa_display_surface_tiled()
Diffstat (limited to 'src/gallium/winsys')
-rw-r--r--src/gallium/winsys/xlib/xm_winsys.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/gallium/winsys/xlib/xm_winsys.c b/src/gallium/winsys/xlib/xm_winsys.c
index cc9f49a731..5e9a1f92f1 100644
--- a/src/gallium/winsys/xlib/xm_winsys.c
+++ b/src/gallium/winsys/xlib/xm_winsys.c
@@ -306,11 +306,16 @@ xmesa_display_surface_tiled(XMesaBuffer b, const struct pipe_surface *surf)
for (y = 0; y < surf->height; y += TILE_SIZE) {
for (x = 0; x < surf->width; x += TILE_SIZE) {
- int dx = x;
- int dy = y;
int tx = x / TILE_SIZE;
int ty = y / TILE_SIZE;
int offset = ty * tilesPerRow + tx;
+ int w = TILE_SIZE;
+ int h = TILE_SIZE;
+
+ if (y + h > surf->height)
+ h = surf->height - y;
+ if (x + w > surf->width)
+ w = surf->width - x;
offset *= 4 * TILE_SIZE * TILE_SIZE;
@@ -319,11 +324,12 @@ xmesa_display_surface_tiled(XMesaBuffer b, const struct pipe_surface *surf)
if (XSHM_ENABLED(xm_buf)) {
#if defined(USE_XSHM) && !defined(XFree86Server)
XShmPutImage(b->xm_visual->display, b->drawable, b->gc,
- ximage, 0, 0, x, y, TILE_SIZE, TILE_SIZE, False);
+ ximage, 0, 0, x, y, w, h, False);
#endif
- } else {
+ }
+ else {
XPutImage(b->xm_visual->display, b->drawable, b->gc,
- ximage, 0, 0, dx, dy, TILE_SIZE, TILE_SIZE);
+ ximage, 0, 0, x, y, w, h);
}
}
}