From bdc1b0869599901592755d8c85764d8d467879cf Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sun, 16 Jan 2005 22:06:36 +0000 Subject: [PATCH] pass DAR to the display; preserve aspect ratio in screenshots --- stepmania/src/RageDisplay.cpp | 11 ++++++++--- stepmania/src/RageDisplay.h | 5 ++++- stepmania/src/StepMania.cpp | 3 ++- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/stepmania/src/RageDisplay.cpp b/stepmania/src/RageDisplay.cpp index 04c7451475..afefb10d5b 100644 --- a/stepmania/src/RageDisplay.cpp +++ b/stepmania/src/RageDisplay.cpp @@ -669,10 +669,15 @@ bool RageDisplay::SaveScreenshot( CString sPath, GraphicsFileFormat format ) RageSurface* surface = this->CreateScreenshot(); /* Unless we're in lossless, resize the image to 640x480. If we're saving lossy, - * there's no sense in saving 1280x960 screenshots, and if we're in a custom - * resolution (eg. 640x240), we don't want to output in that resolution. */ + * there's no sense in saving 1280x960 screenshots, and we don't want to output + * screenshots in a strange (non-1) sample aspect ratio. */ if( format != SAVE_LOSSLESS && (surface->h != 640 || surface->w != 480) ) - RageSurfaceUtils::Zoom( surface, 640, 480 ); + { + /* Maintain the DAR. */ + int iWidth = lrintf( 640 / GetVideoModeParams().fDisplayAspectRatio ); + LOG->Trace( "%ix%i -> %ix%i (%.3f)", surface->w, surface->h, 640, iWidth, GetVideoModeParams().fDisplayAspectRatio ); + RageSurfaceUtils::Zoom( surface, 640, iWidth ); + } RageFile out; if( !out.Open( sPath, RageFile::WRITE ) ) diff --git a/stepmania/src/RageDisplay.h b/stepmania/src/RageDisplay.h index 7f830772ae..1e51e4c2cd 100644 --- a/stepmania/src/RageDisplay.h +++ b/stepmania/src/RageDisplay.h @@ -117,7 +117,8 @@ public: bool bAnisotropicFiltering_, CString sWindowTitle_, CString sIconFile_, - bool PAL_ + bool PAL_, + float fDisplayAspectRatio_ ) { windowed = windowed_; @@ -133,6 +134,7 @@ public: sWindowTitle = sWindowTitle_; sIconFile = sIconFile_; PAL = PAL_; + fDisplayAspectRatio = fDisplayAspectRatio_; } VideoModeParams() {} @@ -147,6 +149,7 @@ public: bool bAnisotropicFiltering; bool interlaced; bool PAL; + float fDisplayAspectRatio; CString sWindowTitle; CString sIconFile; }; diff --git a/stepmania/src/StepMania.cpp b/stepmania/src/StepMania.cpp index 037f7d382b..10c1941516 100644 --- a/stepmania/src/StepMania.cpp +++ b/stepmania/src/StepMania.cpp @@ -92,7 +92,8 @@ static RageDisplay::VideoModeParams GetCurVideoModeParams() PREFSMAN->m_bAnisotropicFiltering, WINDOW_TITLE, THEME->GetPathToG("Common window icon"), - PREFSMAN->m_bPAL + PREFSMAN->m_bPAL, + PREFSMAN->m_fAspectRatio ); }