mirror of
https://github.com/mkxp-z/mkxp-z.git
synced 2025-09-10 12:02:53 +02:00
Only flip screenshots outside of Windows
This commit is contained in:
parent
d72672d94d
commit
d57079bbbc
1 changed files with 8 additions and 1 deletions
|
@ -966,7 +966,13 @@ void Graphics::screenshot(const char *filename)
|
|||
{
|
||||
int w = width();
|
||||
int h = height();
|
||||
|
||||
#ifdef __WIN32__
|
||||
SDL_Surface *img = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, 32, 0,0,0,0);
|
||||
if (!img) throw Exception(Exception::SDLError, "%s", SDL_GetError());
|
||||
|
||||
glReadBuffer(GL_FRONT);
|
||||
glReadPixels(0,0,w,h,GL_BGRA,GL_UNSIGNED_BYTE, img->pixels);
|
||||
#else
|
||||
SDL_Surface *tmp, *img;
|
||||
tmp = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, 32, 0,0,0,0);
|
||||
img = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, 32, 0,0,0,0);
|
||||
|
@ -987,6 +993,7 @@ void Graphics::screenshot(const char *filename)
|
|||
4 * w);
|
||||
}
|
||||
SDL_FreeSurface(tmp);
|
||||
#endif
|
||||
|
||||
char *fn_normalized = shState->fileSystem().normalize(filename, 1, 1);
|
||||
int rc = SDL_SaveBMP(img, fn_normalized);
|
||||
|
|
Loading…
Add table
Reference in a new issue