diff --git a/src/emucore/EventHandler.cxx b/src/emucore/EventHandler.cxx index 83ddc41dc..3494f63b1 100644 --- a/src/emucore/EventHandler.cxx +++ b/src/emucore/EventHandler.cxx @@ -1931,7 +1931,7 @@ void EventHandler::takeSnapshot(uInt32 number) { // Make sure we have a 'clean' image, with no onscreen messages myOSystem.frameBuffer().enableMessages(false); - myOSystem.frameBuffer().tiaSurface().render(); + myOSystem.frameBuffer().tiaSurface().reRender(); string message = "Snapshot saved"; try diff --git a/src/emucore/TIASurface.cxx b/src/emucore/TIASurface.cxx index b2b41c18b..4cef17504 100644 --- a/src/emucore/TIASurface.cxx +++ b/src/emucore/TIASurface.cxx @@ -387,3 +387,49 @@ void TIASurface::render() mySLineSurface->render(); } } + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void TIASurface::reRender() +{ + uInt32 width = myTIA->width(); + uInt32 height = myTIA->height(); + uInt32 pos = 0; + uInt32 *outPtr, outPitch; + + myTiaSurface->basePtr(outPtr, outPitch); + + switch (myFilter) + { + // for non-phosphor modes, render the frame again + case Filter::Normal: + case Filter::BlarggNormal: + render(); + break; + // for phosphor modes, copy the phosphor framebuffer + case Filter::Phosphor: + for (uInt32 y = height; y; --y) + { + memcpy(outPtr, myRGBFramebuffer + pos, width); + outPtr += outPitch; + pos += width; + } + break; + case Filter::BlarggPhosphor: + memcpy(outPtr, myRGBFramebuffer, height * outPitch << 2); + break; + } + + if (myUsePhosphor) + { + // Draw TIA image + myTiaSurface->setDirty(); + myTiaSurface->render(); + + // Draw overlaying scanlines + if (myScanlinesEnabled) + { + mySLineSurface->setDirty(); + mySLineSurface->render(); + } + } +} diff --git a/src/emucore/TIASurface.hxx b/src/emucore/TIASurface.hxx index f8f35db26..702d54cac 100644 --- a/src/emucore/TIASurface.hxx +++ b/src/emucore/TIASurface.hxx @@ -151,6 +151,11 @@ class TIASurface */ void render(); + /** + This method renders the current frame again. + */ + void reRender(); + private: OSystem& myOSystem; FrameBuffer& myFB;