summaryrefslogtreecommitdiff
path: root/src/render/modernopenglgraphics.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-12-16 01:03:19 +0300
committerAndrei Karas <akaras@inbox.ru>2015-12-16 01:03:19 +0300
commit78fb544aeb8761e8d554487487bc27e610822e2d (patch)
tree45ec42f5dcba94cd391f54a4cef2c017d7318d38 /src/render/modernopenglgraphics.cpp
parentfcdc44b21bda79052205ca1884b7f3a1ebd32957 (diff)
downloadplus-78fb544aeb8761e8d554487487bc27e610822e2d.tar.gz
plus-78fb544aeb8761e8d554487487bc27e610822e2d.tar.bz2
plus-78fb544aeb8761e8d554487487bc27e610822e2d.tar.xz
plus-78fb544aeb8761e8d554487487bc27e610822e2d.zip
Use screenshort helpers for creating screenshots
Diffstat (limited to 'src/render/modernopenglgraphics.cpp')
-rw-r--r--src/render/modernopenglgraphics.cpp57
1 files changed, 0 insertions, 57 deletions
diff --git a/src/render/modernopenglgraphics.cpp b/src/render/modernopenglgraphics.cpp
index fc59a7413..1ff55045c 100644
--- a/src/render/modernopenglgraphics.cpp
+++ b/src/render/modernopenglgraphics.cpp
@@ -849,63 +849,6 @@ void ModernOpenGLGraphics::endDraw()
popClipArea();
}
-void ModernOpenGLGraphics::prepareScreenshot()
-{
- if (config.getBoolValue("usefbo"))
- graphicsManager.createFBO(mRect.w, mRect.h, &mFbo);
-}
-
-SDL_Surface* ModernOpenGLGraphics::getScreenshot()
-{
- const int h = mRect.h;
- const int w = mRect.w - (mRect.w % 4);
- GLint pack = 1;
-
- SDL_Surface *const screenshot = MSDL_CreateRGBSurface(
- SDL_SWSURFACE, w, h, 24,
- 0xff0000, 0x00ff00, 0x0000ff, 0x000000);
-
- if (!screenshot)
- return nullptr;
-
- if (SDL_MUSTLOCK(screenshot))
- SDL_LockSurface(screenshot);
-
- const size_t lineSize = 3 * w;
- GLubyte *const buf = new GLubyte[lineSize];
-
- // Grap the pixel buffer and write it to the SDL surface
- mglGetIntegerv(GL_PACK_ALIGNMENT, &pack);
- mglPixelStorei(GL_PACK_ALIGNMENT, 1);
- mglReadPixels(0, 0, w, h, GL_RGB, GL_UNSIGNED_BYTE, screenshot->pixels);
-
- // Flip the screenshot, as OpenGL has 0,0 in bottom left
- const int h2 = h / 2;
- for (int i = 0; i < h2; i++)
- {
- GLubyte *const top = static_cast<GLubyte*>(
- screenshot->pixels) + lineSize * i;
- GLubyte *const bot = static_cast<GLubyte*>(
- screenshot->pixels) + lineSize * (h - 1 - i);
-
- memcpy(buf, top, lineSize);
- memcpy(top, bot, lineSize);
- memcpy(bot, buf, lineSize);
- }
-
- delete [] buf;
-
- if (config.getBoolValue("usefbo"))
- graphicsManager.deleteFBO(&mFbo);
-
- mglPixelStorei(GL_PACK_ALIGNMENT, pack);
-
- if (SDL_MUSTLOCK(screenshot))
- SDL_UnlockSurface(screenshot);
-
- return screenshot;
-}
-
void ModernOpenGLGraphics::pushClipArea(const Rect &area)
{
Graphics::pushClipArea(area);