Clear TIA image when chaning scanline count.

This commit is contained in:
Christian Speckner 2020-01-07 21:15:24 +01:00
parent c4e7088b0e
commit fb2874732d
3 changed files with 18 additions and 3 deletions

View File

@ -219,9 +219,15 @@ void TIASurface::enableNTSC(bool enable)
{ {
myFilter = Filter(enable ? uInt8(myFilter) | 0x10 : uInt8(myFilter) & 0x01); myFilter = Filter(enable ? uInt8(myFilter) | 0x10 : uInt8(myFilter) & 0x01);
// Normal vs NTSC mode uses different source widths uInt32 surfaceWidth = enable ?
myTiaSurface->setSrcSize(enable ? AtariNTSC::outWidth(TIAConstants::frameBufferWidth) AtariNTSC::outWidth(TIAConstants::frameBufferWidth) : TIAConstants::frameBufferWidth;
: TIAConstants::frameBufferWidth, myTIA->height());
if (surfaceWidth != myTiaSurface->srcRect().w() || myTIA->height() != myTiaSurface->srcRect().h()) {
myTiaSurface->setSrcSize(surfaceWidth, myTIA->height());
myTiaSurface->invalidate();
myTIA->clearFrameBuffer();
}
mySLineSurface->setSrcSize(1, 2 * myTIA->height()); mySLineSurface->setSrcSize(1, 2 * myTIA->height());

View File

@ -899,6 +899,13 @@ void TIA::renderToFrameBuffer()
myFrameBufferScanlines = myFrontBufferScanlines; myFrameBufferScanlines = myFrontBufferScanlines;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TIA::clearFrameBuffer()
{
myFramebuffer.fill(0);
myFrontBuffer.fill(0);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TIA::update(uInt64 maxCycles) void TIA::update(uInt64 maxCycles)
{ {

View File

@ -244,6 +244,8 @@ class TIA : public Device
*/ */
uInt8* frameBuffer() { return myFramebuffer.data(); } uInt8* frameBuffer() { return myFramebuffer.data(); }
void clearFrameBuffer();
/** /**
Answers dimensional info about the framebuffer. Answers dimensional info about the framebuffer.
*/ */