Add some clarifying comments on screenshots.

This commit is contained in:
Themaister 2012-06-09 10:29:50 +02:00
parent 553b1d640a
commit 9e650a9540
2 changed files with 4 additions and 1 deletions

View File

@ -109,6 +109,7 @@ static bool take_screenshot_viewport(void)
return false; return false;
} }
// Data read from viewport is in bottom-up order, suitable for BMP.
if (!screenshot_dump(g_settings.screenshot_directory, if (!screenshot_dump(g_settings.screenshot_directory,
buffer, buffer,
width, height, width * 3, true)) width, height, width * 3, true))
@ -127,6 +128,8 @@ static bool take_screenshot_raw(void)
unsigned height = g_extern.frame_cache.height; unsigned height = g_extern.frame_cache.height;
int pitch = g_extern.frame_cache.pitch; int pitch = g_extern.frame_cache.pitch;
// Negative pitch is needed as screenshot takes bottom-up,
// but we use top-down.
return screenshot_dump(g_settings.screenshot_directory, return screenshot_dump(g_settings.screenshot_directory,
data + (height - 1) * (pitch >> 1), data + (height - 1) * (pitch >> 1),
width, height, -pitch, false); width, height, -pitch, false);

View File

@ -85,7 +85,7 @@ static void dump_content(FILE *file, const void *frame,
if (!line) if (!line)
return; return;
if (bgr24) if (bgr24) // BGR24 byte order. Can directly copy.
{ {
for (int j = 0; j < height; j++, frame_bgr += pitch) for (int j = 0; j < height; j++, frame_bgr += pitch)
{ {