Fix and speed up png screenshots when the display uses 24 bpp.
Untested.
This commit is contained in:
parent
f8fc99df26
commit
e5ec703759
1 changed files with 3 additions and 7 deletions
|
@ -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: {
|
||||
|
|
Loading…
Add table
Reference in a new issue