# HG changeset patch # User Vladimir Nadvornik # Date 1296317739 -3600 # Node ID a0cd1875b1af141eba871b2c8956febef7e87b2b # Parent b69a33a93ace172b97b8f38d8a9e29ac912e5823 do not draw tiles outside the viewport diff -r b69a33a93ace -r a0cd1875b1af src/renderer-tiles.c --- a/src/renderer-tiles.c Sat Jan 29 14:49:38 2011 +0100 +++ b/src/renderer-tiles.c Sat Jan 29 17:15:39 2011 +0100 @@ -1408,7 +1408,7 @@ x, y, x, y, w, h, - pr->dither_quality, it->x + x + rt->stereo_off_x, it->y + y + rt->stereo_off_y); + pr->dither_quality, it->x + x, it->y + y); } #if 0 @@ -1428,6 +1428,28 @@ PixbufRenderer *pr = rt->pr; GtkWidget *box; + /* clamp to visible */ + if (it->x + x < pr->x_scroll) + { + w -= pr->x_scroll - it->x - x; + x = pr->x_scroll - it->x; + } + if (it->x + x + w > pr->x_scroll + pr->vis_width) + { + w = pr->x_scroll + pr->vis_width - it->x - x; + } + if (w < 1) return; + if (it->y + y < pr->y_scroll) + { + h -= pr->y_scroll - it->y - y; + y = pr->y_scroll - it->y; + } + if (it->y + y + h > pr->y_scroll + pr->vis_height) + { + h = pr->y_scroll + pr->vis_height - it->y - y; + } + if (h < 1) return; + rt_tile_render(rt, it, x, y, w, h, new_data, fast); box = GTK_WIDGET(pr);