src/screenshot.cpp
changeset 8249 90bd3316062f
parent 8225 cd84a95b6630
child 8254 1496654ca5e7
--- a/src/screenshot.cpp	Fri Jan 11 15:10:59 2008 +0000
+++ b/src/screenshot.cpp	Fri Jan 11 17:12:41 2008 +0000
@@ -488,13 +488,29 @@
 	blitter->CopyImageToBuffer(src, buf, _screen.width, n, pitch);
 }
 
-/* generate a large piece of the world */
+/** generate a large piece of the world
+ * @param userdata Viewport area to draw
+ * @param buf Videobuffer with same bitdepth as current blitter
+ * @param y First line to render
+ * @param pitch Pitch of the videobuffer
+ * @param n Number of lines to render
+ */
 static void LargeWorldCallback(void *userdata, void *buf, uint y, uint pitch, uint n)
 {
 	ViewPort *vp = (ViewPort *)userdata;
 	DrawPixelInfo dpi, *old_dpi;
 	int wx, left;
 
+	/* We are no longer rendering to the screen */
+	DrawPixelInfo old_screen = _screen;
+	bool old_disable_anim = _screen_disable_anim;
+
+	_screen.dst_ptr = buf;
+	_screen.width = pitch;
+	_screen.height = n;
+	_screen.pitch = pitch;
+	_screen_disable_anim = true;
+
 	old_dpi = _cur_dpi;
 	_cur_dpi = &dpi;
 
@@ -506,6 +522,7 @@
 	dpi.left = 0;
 	dpi.top = y;
 
+	/* Render viewport in blocks of 1600 pixels width */
 	left = 0;
 	while (vp->width - left != 0) {
 		wx = min(vp->width - left, 1600);
@@ -520,6 +537,10 @@
 	}
 
 	_cur_dpi = old_dpi;
+
+	/* Switch back to rendering to the screen */
+	_screen = old_screen;
+	_screen_disable_anim = old_disable_anim;
 }
 
 static char *MakeScreenshotName(const char *ext)