summaryrefslogtreecommitdiff
path: root/src/screenshot.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2008-01-11 17:12:41 +0000
committerfrosch <frosch@openttd.org>2008-01-11 17:12:41 +0000
commit7d3ecec5b965870aaaaad339079a3ad46d9e8a1e (patch)
tree1c8f4f25209426578fbcfb87aa8be78f439db8c0 /src/screenshot.cpp
parentfa1f94e599c317c234ed07f18adbddd527b86470 (diff)
downloadopenttd-7d3ecec5b965870aaaaad339079a3ad46d9e8a1e.tar.xz
(svn r11813) -Fix [FS#1602]: Switch _screen to the output buffer and disable usage of 32bpp-anim animation buffer during giant screenshots.
Diffstat (limited to 'src/screenshot.cpp')
-rw-r--r--src/screenshot.cpp23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/screenshot.cpp b/src/screenshot.cpp
index c20512d6c..822a3e0cf 100644
--- a/src/screenshot.cpp
+++ b/src/screenshot.cpp
@@ -488,13 +488,29 @@ static void CurrentScreenCallback(void *userdata, void *buf, uint y, uint pitch,
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 @@ static void LargeWorldCallback(void *userdata, void *buf, uint y, uint pitch, ui
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 @@ static void LargeWorldCallback(void *userdata, void *buf, uint y, uint pitch, ui
}
_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)