diff --git a/src/emucore/TIASurface.cxx b/src/emucore/TIASurface.cxx index 74cdc2efa..17b75197d 100644 --- a/src/emucore/TIASurface.cxx +++ b/src/emucore/TIASurface.cxx @@ -219,9 +219,15 @@ void TIASurface::enableNTSC(bool enable) { myFilter = Filter(enable ? uInt8(myFilter) | 0x10 : uInt8(myFilter) & 0x01); - // Normal vs NTSC mode uses different source widths - myTiaSurface->setSrcSize(enable ? AtariNTSC::outWidth(TIAConstants::frameBufferWidth) - : TIAConstants::frameBufferWidth, myTIA->height()); + uInt32 surfaceWidth = enable ? + AtariNTSC::outWidth(TIAConstants::frameBufferWidth) : TIAConstants::frameBufferWidth; + + 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()); diff --git a/src/emucore/tia/TIA.cxx b/src/emucore/tia/TIA.cxx index f713f0586..60608b765 100644 --- a/src/emucore/tia/TIA.cxx +++ b/src/emucore/tia/TIA.cxx @@ -899,6 +899,13 @@ void TIA::renderToFrameBuffer() myFrameBufferScanlines = myFrontBufferScanlines; } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void TIA::clearFrameBuffer() +{ + myFramebuffer.fill(0); + myFrontBuffer.fill(0); +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void TIA::update(uInt64 maxCycles) { diff --git a/src/emucore/tia/TIA.hxx b/src/emucore/tia/TIA.hxx index 0ff1afb67..a25a942d1 100644 --- a/src/emucore/tia/TIA.hxx +++ b/src/emucore/tia/TIA.hxx @@ -244,6 +244,8 @@ class TIA : public Device */ uInt8* frameBuffer() { return myFramebuffer.data(); } + void clearFrameBuffer(); + /** Answers dimensional info about the framebuffer. */