Fix and speed up png screenshots when the display uses 24 bpp.

Untested.
This commit is contained in:
feb 2011-07-17 19:45:15 +00:00
parent f8fc99df26
commit e5ec703759

View file

@ -333,9 +333,7 @@ void SaveScreenshotPNG(const std::string &name)
png_infop info_ptr;
int i;
int j;
int bpp;
bpp = TheScreen->format->BytesPerPixel;
fp = fopen(name.c_str(), "wb");
if (fp == NULL) {
@ -404,11 +402,9 @@ void SaveScreenshotPNG(const std::string &name)
break;
}
case 24: {
Uint8 c;
for (j = 0; j < Video.Width; ++j) {
c = ((Uint8 *)TheScreen->pixels)[j * bpp + i * Video.Width * 3];
memcpy(row, (char *)TheScreen->pixels + i * Video.Width, Video.Width * 3);
}
char *c;
c = (char *)TheScreen->pixels + i * Video.Width * 3;
memcpy(row, c, Video.Width * 3);
break;
}
case 32: {