GRIM: Enable screenshot saving on ES2
This commit is contained in:
parent
66bcfa4ca6
commit
0a73f11e9c
1 changed files with 5 additions and 6 deletions
|
@ -2034,8 +2034,8 @@ static void readPixels(int x, int y, int width, int height, byte *buffer) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Bitmap *GfxOpenGLS::getScreenshot(int w, int h, bool useStored) {
|
Bitmap *GfxOpenGLS::getScreenshot(int w, int h, bool useStored) {
|
||||||
#ifndef USE_GLES2
|
|
||||||
Graphics::PixelBuffer src(Graphics::PixelFormat(4, 8, 8, 8, 8, 0, 8, 16, 24), _screenWidth * _screenHeight, DisposeAfterUse::YES);
|
Graphics::PixelBuffer src(Graphics::PixelFormat(4, 8, 8, 8, 8, 0, 8, 16, 24), _screenWidth * _screenHeight, DisposeAfterUse::YES);
|
||||||
|
#ifndef USE_GLES2
|
||||||
if (useStored) {
|
if (useStored) {
|
||||||
glBindTexture(GL_TEXTURE_2D, _storedDisplay);
|
glBindTexture(GL_TEXTURE_2D, _storedDisplay);
|
||||||
char *buffer = new char[_screenWidth * _screenHeight * 4];
|
char *buffer = new char[_screenWidth * _screenHeight * 4];
|
||||||
|
@ -2044,13 +2044,12 @@ Bitmap *GfxOpenGLS::getScreenshot(int w, int h, bool useStored) {
|
||||||
memcpy(src.getRawBuffer(), buffer, _screenWidth * _screenHeight * 4);
|
memcpy(src.getRawBuffer(), buffer, _screenWidth * _screenHeight * 4);
|
||||||
|
|
||||||
delete[] buffer;
|
delete[] buffer;
|
||||||
} else {
|
} else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
readPixels(0, 0, _screenWidth, _screenHeight, src.getRawBuffer());
|
readPixels(0, 0, _screenWidth, _screenHeight, src.getRawBuffer());
|
||||||
}
|
}
|
||||||
return createScreenshotBitmap(src, w, h, false);
|
return createScreenshotBitmap(src, w, h, true);
|
||||||
#else
|
|
||||||
return nullptr;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GfxOpenGLS::createSpecialtyTextureFromScreen(uint id, uint8 *data, int x, int y, int width, int height) {
|
void GfxOpenGLS::createSpecialtyTextureFromScreen(uint id, uint8 *data, int x, int y, int width, int height) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue