From f11cc182df9b1647a7c2959938f0e87df62dab97 Mon Sep 17 00:00:00 2001 From: Jonas Kulla Date: Wed, 16 Apr 2014 13:48:45 +0200 Subject: [PATCH] Remove screenshot functionality It was only meant for debugging and brought with it unneeded platform dependant issues. --- src/config.cpp | 2 -- src/config.h | 1 - src/eventthread.cpp | 3 --- src/eventthread.h | 5 +---- src/graphics.cpp | 40 ---------------------------------------- 5 files changed, 1 insertion(+), 50 deletions(-) diff --git a/src/config.cpp b/src/config.cpp index 4f15a51..20e3da4 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -35,7 +35,6 @@ namespace po = boost::program_options; Config::Config() : debugMode(false), - screenshots(false), winResizable(false), fullscreen(false), fixedAspectRatio(true), @@ -56,7 +55,6 @@ void Config::read(int argc, char *argv[]) { #define PO_DESC_ALL \ PO_DESC(debugMode, bool) \ - PO_DESC(screenshots, bool) \ PO_DESC(winResizable, bool) \ PO_DESC(fullscreen, bool) \ PO_DESC(fixedAspectRatio, bool) \ diff --git a/src/config.h b/src/config.h index 2854672..9bc7b6c 100644 --- a/src/config.h +++ b/src/config.h @@ -28,7 +28,6 @@ struct Config { bool debugMode; - bool screenshots; bool winResizable; bool fullscreen; diff --git a/src/eventthread.cpp b/src/eventthread.cpp index acdb161..fa671ad 100644 --- a/src/eventthread.cpp +++ b/src/eventthread.cpp @@ -209,9 +209,6 @@ void EventThread::process(RGSSThreadData &rtData) break; } - if (event.key.keysym.scancode == SDL_SCANCODE_F3 && rtData.config.screenshots) - rtData.rqScreenshot = true; - keyStates[event.key.keysym.scancode] = true; break; diff --git a/src/eventthread.h b/src/eventthread.h index 5ed27c1..79ac199 100644 --- a/src/eventthread.h +++ b/src/eventthread.h @@ -178,8 +178,6 @@ struct RGSSThreadData std::string rgssErrorMsg; - volatile bool rqScreenshot; - RGSSThreadData(EventThread *ethread, const char *argv0, SDL_Window *window, @@ -190,8 +188,7 @@ struct RGSSThreadData argv0(argv0), window(window), sizeResoRatio(1, 1), - config(newconf), - rqScreenshot(false) + config(newconf) {} }; diff --git a/src/graphics.cpp b/src/graphics.cpp index fa02a9c..d87277a 100644 --- a/src/graphics.cpp +++ b/src/graphics.cpp @@ -507,44 +507,6 @@ struct GraphicsPrivate swapGLBuffer(); } - - void writeScreenshot(const char *filename) - { - int bpp; - uint32_t rm, gm, bm, am; - SDL_PixelFormatEnumToMasks(SDL_PIXELFORMAT_ABGR8888, &bpp, &rm, &gm, &bm, &am); - - /* Discard alpha channel because it might have bogus values */ - SDL_Surface *screenshot = - SDL_CreateRGBSurface(0, scRes.x, scRes.y, bpp, rm, gm, bm, 0); - - screen.getPP().bindLastBuffer(); - - glReadPixels(0, 0, scRes.x, scRes.y, GL_RGBA, GL_UNSIGNED_BYTE, screenshot->pixels); - - IMG_SavePNG(screenshot, filename); - - SDL_FreeSurface(screenshot); - } - - void checkScreenshotRq() - { - if (!threadData->rqScreenshot) - return; - - threadData->rqScreenshot = false; - - struct timeval tv; - gettimeofday(&tv, 0); - struct tm tm = *localtime(&tv.tv_sec); - - char filename[32]; - - snprintf(filename, sizeof(filename), "%d%02d%02d-%02d%02d%02d.png", - tm.tm_year+1900, tm.tm_mon+1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec); - - writeScreenshot(filename); - } }; Graphics::Graphics(RGSSThreadData *data) @@ -568,8 +530,6 @@ void Graphics::update() // p->cpuTimer->endTiming(); // p->gpuTimer->startTiming(); - p->checkScreenshotRq(); - if (p->frozen) return;