summaryrefslogtreecommitdiff
path: root/src/render/normalopenglgraphics.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/render/normalopenglgraphics.cpp')
-rw-r--r--src/render/normalopenglgraphics.cpp58
1 files changed, 0 insertions, 58 deletions
diff --git a/src/render/normalopenglgraphics.cpp b/src/render/normalopenglgraphics.cpp
index f58e10f92..b86859f6d 100644
--- a/src/render/normalopenglgraphics.cpp
+++ b/src/render/normalopenglgraphics.cpp
@@ -1268,64 +1268,6 @@ void NormalOpenGLGraphics::endDraw()
popClipArea();
}
-void NormalOpenGLGraphics::prepareScreenshot()
-{
- if (config.getBoolValue("usefbo"))
- graphicsManager.createFBO(mRect.w, mRect.h, &mFbo);
-}
-
-SDL_Surface* NormalOpenGLGraphics::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);
-
- // Grap the pixel buffer and write it to the SDL surface
- glGetIntegerv(GL_PACK_ALIGNMENT, &pack);
- glPixelStorei(GL_PACK_ALIGNMENT, 1);
- glReadPixels(0, 0, w, h, GL_RGB, GL_UNSIGNED_BYTE, screenshot->pixels);
-
- // Flip the screenshot, as OpenGL has 0,0 in bottom left
- const size_t lineSize = 3 * w;
- GLubyte *const buf = new GLubyte[lineSize];
-
- const int h2 = h / 2;
- for (int i = 0; i < h2; i++)
- {
- GLubyte *const top = static_cast<GLubyte *const>(
- screenshot->pixels) + lineSize * i;
- GLubyte *const bot = static_cast<GLubyte *const>(
- 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);
-
- glPixelStorei(GL_PACK_ALIGNMENT, pack);
-
- if (SDL_MUSTLOCK(screenshot))
- SDL_UnlockSurface(screenshot);
-
- return screenshot;
-}
-
void NormalOpenGLGraphics::pushClipArea(const Rect &area)
{
int transX = 0;