mirror of https://github.com/stella-emu/stella.git
Fix snapshots on retina displays.
This commit is contained in:
parent
6e5a162a18
commit
4d99bca2cd
|
@ -137,12 +137,12 @@ class FrameBufferSDL2 : public FrameBuffer
|
|||
/**
|
||||
Transform from window to renderer coordinates, x direction
|
||||
*/
|
||||
int scaleX(int x) const { return (x * myRenderW) / myWindowW; }
|
||||
int scaleX(int x) const override { return (x * myRenderW) / myWindowW; }
|
||||
|
||||
/**
|
||||
Transform from window to renderer coordinates, y direction
|
||||
*/
|
||||
int scaleY(int y) const { return (y * myRenderH) / myWindowH; }
|
||||
int scaleY(int y) const override { return (y * myRenderH) / myWindowH; }
|
||||
|
||||
protected:
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "TIASurface.hxx"
|
||||
#include "Version.hxx"
|
||||
#include "PNGLibrary.hxx"
|
||||
#include "Rect.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
PNGLibrary::PNGLibrary(OSystem& osystem)
|
||||
|
@ -129,7 +130,13 @@ void PNGLibrary::saveImage(const string& filename, const VariantList& comments)
|
|||
throw runtime_error("ERROR: Couldn't create snapshot file");
|
||||
|
||||
const FrameBuffer& fb = myOSystem.frameBuffer();
|
||||
const Common::Rect& rect = fb.imageRect();
|
||||
|
||||
const Common::Rect& rectUnscaled = fb.imageRect();
|
||||
const Common::Rect rect(
|
||||
Common::Point(fb.scaleX(rectUnscaled.x()), fb.scaleY(rectUnscaled.y())),
|
||||
fb.scaleX(rectUnscaled.w()), fb.scaleY(rectUnscaled.h())
|
||||
);
|
||||
|
||||
png_uint_32 width = rect.w(), height = rect.h();
|
||||
|
||||
// Get framebuffer pixel data (we get ABGR format)
|
||||
|
|
|
@ -381,6 +381,16 @@ class FrameBuffer
|
|||
*/
|
||||
virtual void clear() = 0;
|
||||
|
||||
/**
|
||||
Transform from window to renderer coordinates, x direction
|
||||
*/
|
||||
virtual int scaleX(int x) const { return x; }
|
||||
|
||||
/**
|
||||
Transform from window to renderer coordinates, y direction
|
||||
*/
|
||||
virtual int scaleY(int y) const { return y; }
|
||||
|
||||
protected:
|
||||
/**
|
||||
This method is called to query and initialize the video hardware
|
||||
|
|
Loading…
Reference in New Issue