From 367a197df7fe3c0b54036319a831b348c9cf742c Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Fri, 15 Feb 2008 10:10:01 +0000 Subject: [PATCH] add fudge factor to ScaleToClipped to make banner text less likely to be cut off if the banner doesn't exactly match the graphic size (DDR banners in ITG banner shape) --- stepmania/src/Sprite.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/stepmania/src/Sprite.cpp b/stepmania/src/Sprite.cpp index 836fa60683..a21af9f3c5 100644 --- a/stepmania/src/Sprite.cpp +++ b/stepmania/src/Sprite.cpp @@ -845,6 +845,8 @@ void Sprite::ScaleToClipped( float fWidth, float fHeight ) if( !m_pTexture ) return; + float fScaleFudgePercent = 0.15f; // scale up to this amount in one dimension to avoid clipping. + int iSourceWidth = m_pTexture->GetSourceWidth(); int iSourceHeight = m_pTexture->GetSourceHeight(); @@ -902,6 +904,7 @@ void Sprite::ScaleToClipped( float fWidth, float fHeight ) if( bXDimNeedsToBeCropped ) // crop X { float fPercentageToCutOff = (this->GetZoomedWidth() - fWidth) / this->GetZoomedWidth(); + fPercentageToCutOff = max( fPercentageToCutOff-fScaleFudgePercent, 0 ); float fPercentageToCutOffEachSide = fPercentageToCutOff / 2; // generate a rectangle with new texture coordinates @@ -915,6 +918,7 @@ void Sprite::ScaleToClipped( float fWidth, float fHeight ) else // crop Y { float fPercentageToCutOff = (this->GetZoomedHeight() - fHeight) / this->GetZoomedHeight(); + fPercentageToCutOff = max( fPercentageToCutOff-fScaleFudgePercent, 0 ); float fPercentageToCutOffEachSide = fPercentageToCutOff / 2; // generate a rectangle with new texture coordinates