1st part of implementing blended screenshots (see #395)

This commit is contained in:
thrust26 2018-12-06 14:24:07 +01:00
parent b06893d384
commit bef5caafa5
3 changed files with 20 additions and 2 deletions

View File

@ -46,6 +46,7 @@
#include "M6532.hxx" #include "M6532.hxx"
#include "MouseControl.hxx" #include "MouseControl.hxx"
#include "PNGLibrary.hxx" #include "PNGLibrary.hxx"
#include "TIASurface.hxx"
#include "EventHandler.hxx" #include "EventHandler.hxx"
@ -386,7 +387,8 @@ void EventHandler::handleEvent(Event::Type event, Int32 state)
return; return;
case Event::TakeSnapshot: case Event::TakeSnapshot:
if(state) myOSystem.png().takeSnapshot(); //if(state) myOSystem.png().takeSnapshot();
if(state) myOSystem.frameBuffer().tiaSurface().saveSnapShot();
return; return;
case Event::LauncherMode: case Event::LauncherMode:

View File

@ -23,6 +23,7 @@
#include "OSystem.hxx" #include "OSystem.hxx"
#include "Console.hxx" #include "Console.hxx"
#include "TIA.hxx" #include "TIA.hxx"
#include "PNGLibrary.hxx"
#include "TIASurface.hxx" #include "TIASurface.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -34,7 +35,8 @@ TIASurface::TIASurface(OSystem& system)
myUsePhosphor(false), myUsePhosphor(false),
myPhosphorPercent(0.60f), myPhosphorPercent(0.60f),
myScanlinesEnabled(false), myScanlinesEnabled(false),
myPalette(nullptr) myPalette(nullptr),
saveFlag(false)
{ {
// Load NTSC filter settings // Load NTSC filter settings
myNTSCFilter.loadConfig(myOSystem.settings()); myNTSCFilter.loadConfig(myOSystem.settings());
@ -389,6 +391,12 @@ void TIASurface::render()
// Draw overlaying scanlines // Draw overlaying scanlines
if(myScanlinesEnabled) if(myScanlinesEnabled)
mySLineSurface->render(); mySLineSurface->render();
if(saveFlag)
{
saveFlag = false;
myOSystem.png().takeSnapshot();
}
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -155,6 +155,11 @@ class TIASurface
*/ */
void reRender(); void reRender();
/**
Save a snapshot after rendering.
*/
void saveSnapShot() { saveFlag = true; }
private: private:
OSystem& myOSystem; OSystem& myOSystem;
FrameBuffer& myFB; FrameBuffer& myFB;
@ -202,6 +207,9 @@ class TIASurface
// Palette for normal TIA rendering mode // Palette for normal TIA rendering mode
const uInt32* myPalette; const uInt32* myPalette;
// Flag for saving a snapshot
bool saveFlag;
private: private:
// Following constructors and assignment operators not supported // Following constructors and assignment operators not supported
TIASurface() = delete; TIASurface() = delete;