fixed issue #201 with new reRender method

in phosphor modes buffers are simply copied form phosphor buffer, else the screen is rendered again
This commit is contained in:
thrust26 2017-09-18 15:49:30 +02:00
parent 11367e6a17
commit ed47816303
3 changed files with 52 additions and 1 deletions

View File

@ -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

View File

@ -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();
}
}
}

View File

@ -151,6 +151,11 @@ class TIASurface
*/
void render();
/**
This method renders the current frame again.
*/
void reRender();
private:
OSystem& myOSystem;
FrameBuffer& myFB;