From bc06f43a8376783a8eaa059f024a9356832fee0f Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Fri, 4 Jul 2003 23:17:42 +0000 Subject: [PATCH] don't show frame dimensions warning if image is tiny (intentially blanked) --- stepmania/src/RageBitmapTexture.cpp | 48 ++++++++++++++++------------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/stepmania/src/RageBitmapTexture.cpp b/stepmania/src/RageBitmapTexture.cpp index a95da2b8b1..93064b38ef 100644 --- a/stepmania/src/RageBitmapTexture.cpp +++ b/stepmania/src/RageBitmapTexture.cpp @@ -298,29 +298,33 @@ apply_color_key: CreateFrameRects(); - /* Make sure the image has even dimensions. Otherwise, - * pixel/texel alignment will be off. - * TODO: Enforce frames in the image have even dimensions. */ - float fFrameWidth = this->GetSourceWidth() / (float)this->GetFramesWide(); - float fFrameHeight = this->GetSourceHeight() / (float)this->GetFramesHigh(); - float fBetterFrameWidth = roundf((fFrameWidth+0.99f)/2)*2; - float fBetterFrameHeight = roundf((fFrameHeight+0.99f)/2)*2; - float fBetterSourceWidth = this->GetFramesWide() * fBetterFrameWidth; - float fBetterSourceHeight = this->GetFramesWide() * fBetterFrameHeight; - if( fFrameWidth!=fBetterFrameWidth || fFrameHeight!=fBetterFrameHeight ) + /* Enforce frames in the image have even dimensions. Otherwise, + * pixel/texel alignment will be off. + * If it looks like the artist intentionally blanked the image + * by making it very tiny, then don't run the check. */ + if( this->GetSourceWidth()>2 || this->GetSourceHeight()>2 ) { - CString sWarning = ssprintf( - "The graphic '%s' has frame dimensions that aren't even numbers.\n\n" - "The entire image is %dx%d and frame size is %.1fx%.1f.\n\n" - "Image quality will be much improved if you resize the graphic to %.0fx%.0f, which is a frame size of %.0fx%.0f.", - actualID.filename.c_str(), - this->GetSourceWidth(), this->GetSourceHeight(), - fFrameWidth, fFrameHeight, - fBetterSourceWidth, fBetterSourceHeight, - fBetterFrameWidth, fBetterFrameHeight ); - LOG->Warn( sWarning ); - if( DISPLAY->IsWindowed() ) - HOOKS->MessageBoxOK( sWarning ); + float fFrameWidth = this->GetSourceWidth() / (float)this->GetFramesWide(); + float fFrameHeight = this->GetSourceHeight() / (float)this->GetFramesHigh(); + float fBetterFrameWidth = roundf((fFrameWidth+0.99f)/2)*2; + float fBetterFrameHeight = roundf((fFrameHeight+0.99f)/2)*2; + float fBetterSourceWidth = this->GetFramesWide() * fBetterFrameWidth; + float fBetterSourceHeight = this->GetFramesHigh() * fBetterFrameHeight; + if( fFrameWidth!=fBetterFrameWidth || fFrameHeight!=fBetterFrameHeight ) + { + CString sWarning = ssprintf( + "The graphic '%s' has frame dimensions that aren't even numbers.\n\n" + "The entire image is %dx%d and frame size is %.1fx%.1f.\n\n" + "Image quality will be much improved if you resize the graphic to %.0fx%.0f, which is a frame size of %.0fx%.0f.", + actualID.filename.c_str(), + this->GetSourceWidth(), this->GetSourceHeight(), + fFrameWidth, fFrameHeight, + fBetterSourceWidth, fBetterSourceHeight, + fBetterFrameWidth, fBetterFrameHeight ); + LOG->Warn( sWarning ); + if( DISPLAY->IsWindowed() ) + HOOKS->MessageBoxOK( sWarning ); + } } SDL_FreeSurface( img );