Fix TIA images saved in '1x' mode to not use TV effects (fixes #643).

This commit is contained in:
Stephen Anthony 2020-06-18 21:48:51 -02:30
parent 148545bbf8
commit a1d6d6ea41
4 changed files with 13 additions and 19 deletions

View File

@ -35,6 +35,9 @@
* Make NTSC custom phase shift not affect Yellow anymore.
* Fixed '1x' snapshot mode; TV effects are now disabled. This mode
now generates a clean, pixel-exact image.
* A ROM properties file may now be placed next to the ROM (with the same
name as the ROM, except ending in .pro), and Stella will automatically
apply the properties to the ROM. [NOTE: this was present in 6.2, but

View File

@ -179,7 +179,7 @@ void TiaOutputWidget::drawWidget(bool hilite)
bool visible = instance().console().tia().electronBeamPos(scanx, scany);
scanoffset = width * scany + scanx;
uInt8* tiaOutputBuffer = instance().console().tia().outputBuffer();
TIASurface& tiaSurface(instance().frameBuffer().tiaSurface());
const TIASurface& tiaSurface = instance().frameBuffer().tiaSurface();
for(uInt32 y = 0, i = yStart * width; y < height; ++y)
{

View File

@ -148,32 +148,19 @@ const FBSurface& TIASurface::baseSurface(Common::Rect& rect) const
uInt32 tiaw = myTIA->width(), width = tiaw * 2, height = myTIA->height();
rect.setBounds(0, 0, width, height);
// Get Blargg buffer and width
uInt32 *blarggBuf, blarggPitch;
myTiaSurface->basePtr(blarggBuf, blarggPitch);
double blarggXFactor = double(blarggPitch) / width;
bool useBlargg = ntscEnabled();
// Fill the surface with pixels from the TIA, scaled 2x horizontally
uInt32 *buf_ptr, pitch;
myBaseTiaSurface->basePtr(buf_ptr, pitch);
for(uInt32 y = 0; y < height; ++y)
{
for(uInt32 x = 0; x < width; ++x)
{
if (useBlargg)
*buf_ptr++ = blarggBuf[y * blarggPitch + uInt32(nearbyint(x * blarggXFactor))];
else
*buf_ptr++ = myPalette[*(myTIA->frameBuffer() + y * tiaw + x / 2)];
}
}
return *myBaseTiaSurface;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 TIASurface::mapIndexedPixel(uInt8 indexedColor, uInt8 shift)
uInt32 TIASurface::mapIndexedPixel(uInt8 indexedColor, uInt8 shift) const
{
return myPalette[indexedColor | shift];
}

View File

@ -70,14 +70,18 @@ class TIASurface
void setPalette(const PaletteArray& tia_palette, const PaletteArray& rgb_palette);
/**
Get the TIA base surface for use in saving to a PNG image.
Get a TIA surface that has no post-processing whatsoever. This is
currently used to save PNG image in the so-called '1x mode'.
@param rect Specifies the area in which the surface data is valid
*/
const FBSurface& baseSurface(Common::Rect& rect) const;
/**
Use the palette to map a single indexed pixel color. This is used by the TIA output widget.
Use the palette to map a single indexed pixel color. This is used by the
TIA output widget.
*/
uInt32 mapIndexedPixel(uInt8 indexedColor, uInt8 shift = 0);
uInt32 mapIndexedPixel(uInt8 indexedColor, uInt8 shift = 0) const;
/**
Get the NTSCFilter object associated with the framebuffer
@ -220,7 +224,7 @@ class TIASurface
bool mySaveSnapFlag{false};
// The palette handler
unique_ptr<PaletteHandler>myPaletteHandler;
unique_ptr<PaletteHandler> myPaletteHandler;
private:
// Following constructors and assignment operators not supported