From 12c91671bf6118c012df6f1bc9456df2e36f25f3 Mon Sep 17 00:00:00 2001 From: truelight Date: Sat, 25 Sep 2004 18:30:19 +0000 Subject: [PATCH] (svn r321) -Fix: crash when making png screenshot with odd resolution (Tron) -Fix: unable to select other screenshot format in Game Option --- screenshot.c | 8 ++++++-- settings_gui.c | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/screenshot.c b/screenshot.c index c352844e5e..fa94c8acd6 100644 --- a/screenshot.c +++ b/screenshot.c @@ -376,8 +376,12 @@ void SetScreenshotFormat(int i) // screenshot generator that dumps the current video buffer void CurrentScreenCallback(void *userdata, byte *buf, uint y, uint pitch, uint n) { - assert(_screen.pitch == (int)pitch); - memcpy(buf, _screen.dst_ptr + y * _screen.pitch, n * _screen.pitch); + for (; n > 0; --n) + { + memcpy(buf, _screen.dst_ptr + y * _screen.pitch, _screen.width); + ++y; + buf += pitch; + } } extern void ViewportDoDraw(ViewPort *vp, int left, int top, int right, int bottom); diff --git a/settings_gui.c b/settings_gui.c index 9c158569e4..4e75013058 100644 --- a/settings_gui.c +++ b/settings_gui.c @@ -174,7 +174,7 @@ static void GameOptionsWndProc(Window *w, WindowEvent *e) break; // change screenshot format - case 30: + case 31: SetScreenshotFormat(e->dropdown.index); SetWindowDirty(w); break;