do not draw tiles outside the viewport
authorVladimir Nadvornik <nadvornik@suse.cz>
Sat, 29 Jan 2011 16:15:39 +0000 (17:15 +0100)
committerVladimir Nadvornik <nadvornik@suse.cz>
Tue, 27 Sep 2011 12:28:52 +0000 (14:28 +0200)
src/renderer-tiles.c

index fefbaa2..163196e 100644 (file)
@@ -1408,7 +1408,7 @@ static void rt_tile_render(RendererTiles *rt, ImageTile *it,
                                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 @@ static void rt_tile_expose(RendererTiles *rt, ImageTile *it,
        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);