Remove screenshot functionality
It was only meant for debugging and brought with it unneeded platform dependant issues.
This commit is contained in:
		
							parent
							
								
									1ef6e04520
								
							
						
					
					
						commit
						f11cc182df
					
				
					 5 changed files with 1 additions and 50 deletions
				
			
		| 
						 | 
				
			
			@ -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) \
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -28,7 +28,6 @@
 | 
			
		|||
struct Config
 | 
			
		||||
{
 | 
			
		||||
	bool debugMode;
 | 
			
		||||
	bool screenshots;
 | 
			
		||||
 | 
			
		||||
	bool winResizable;
 | 
			
		||||
	bool fullscreen;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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)
 | 
			
		||||
	{}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue