30 #include "render/graphics.h" 32 #ifdef __native_client__ 34 #endif // __native_client__ 63 SDL_SWSURFACE, w, h, 24,
64 0xff0000, 0x00ff00, 0x0000ff, 0x000000);
66 if (screenshot ==
nullptr)
69 if (SDL_MUSTLOCK(screenshot))
70 SDL_LockSurface(screenshot);
72 const size_t lineSize = 3 * w;
73 GLubyte *
const buf =
new GLubyte[lineSize];
78 mglReadPixels(0, 0, w, h, GL_RGB, GL_UNSIGNED_BYTE, screenshot->pixels);
82 for (
int i = 0; i < h2; i++)
84 GLubyte *
const top =
static_cast<GLubyte*
>(
85 screenshot->pixels) + lineSize * i;
86 GLubyte *
const bot =
static_cast<GLubyte*
>(
87 screenshot->pixels) + lineSize * (h - 1 - i);
89 memcpy(buf, top, lineSize);
90 memcpy(top, bot, lineSize);
91 memcpy(bot, buf, lineSize);
101 if (SDL_MUSTLOCK(screenshot))
102 SDL_UnlockSurface(screenshot);
SDL_Surface * getScreenshot()
bool screenshot(InputEvent &event)
const Image *restrict const top
bool getBoolValue(const std::string &key) const
static void deleteFBO(FBOInfo *const fbo)
#define mglPixelStorei(...)
~OpenGLScreenshotHelper()
#define mglGetIntegerv(...)
#define mglReadPixels(...)
GraphicsManager graphicsManager
static void createFBO(const int width, const int height, FBOInfo *const fbo)
#define MSDL_CreateRGBSurface(flags, w, h, d, r, g, b, a)