don't show frame dimensions warning if image is tiny (intentially blanked)
This commit is contained in:
@@ -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 );
|
||||
|
||||
Reference in New Issue
Block a user