add "doubleres" hint, adjust dimension multiple checking for doubleres
This commit is contained in:
@@ -239,14 +239,22 @@ void RageBitmapTexture::Create()
|
|||||||
CreateFrameRects();
|
CreateFrameRects();
|
||||||
|
|
||||||
|
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// Enforce frames in the image have even dimensions. Otherwise,
|
// Enforce frames in the image have even dimensions. Otherwise,
|
||||||
// pixel/texel alignment will be off.
|
// pixel/texel alignment will be off.
|
||||||
//
|
//
|
||||||
|
int iDimensionMultiple = 2;
|
||||||
|
|
||||||
|
if( sHintString.find("doubleres") != string::npos )
|
||||||
|
{
|
||||||
|
iDimensionMultiple = 4;
|
||||||
|
}
|
||||||
|
|
||||||
bool bRunCheck = true;
|
bool bRunCheck = true;
|
||||||
|
|
||||||
// Don't check if the artist intentionally blanked the image by making it very tiny.
|
// Don't check if the artist intentionally blanked the image by making it very tiny.
|
||||||
if( this->GetSourceWidth()<=2 || this->GetSourceHeight()<=2 )
|
if( this->GetSourceWidth()<=iDimensionMultiple || this->GetSourceHeight()<=iDimensionMultiple )
|
||||||
bRunCheck = false;
|
bRunCheck = false;
|
||||||
|
|
||||||
// HACK: Don't check song graphics. Many of them are weird dimensions.
|
// HACK: Don't check song graphics. Many of them are weird dimensions.
|
||||||
@@ -257,17 +265,18 @@ void RageBitmapTexture::Create()
|
|||||||
{
|
{
|
||||||
float fFrameWidth = this->GetSourceWidth() / (float)this->GetFramesWide();
|
float fFrameWidth = this->GetSourceWidth() / (float)this->GetFramesWide();
|
||||||
float fFrameHeight = this->GetSourceHeight() / (float)this->GetFramesHigh();
|
float fFrameHeight = this->GetSourceHeight() / (float)this->GetFramesHigh();
|
||||||
float fBetterFrameWidth = roundf((fFrameWidth+0.99f)/2)*2;
|
float fBetterFrameWidth = ceilf(fFrameWidth/iDimensionMultiple) * iDimensionMultiple;
|
||||||
float fBetterFrameHeight = roundf((fFrameHeight+0.99f)/2)*2;
|
float fBetterFrameHeight = ceilf(fFrameHeight/iDimensionMultiple) * iDimensionMultiple;
|
||||||
float fBetterSourceWidth = this->GetFramesWide() * fBetterFrameWidth;
|
float fBetterSourceWidth = this->GetFramesWide() * fBetterFrameWidth;
|
||||||
float fBetterSourceHeight = this->GetFramesHigh() * fBetterFrameHeight;
|
float fBetterSourceHeight = this->GetFramesHigh() * fBetterFrameHeight;
|
||||||
if( fFrameWidth!=fBetterFrameWidth || fFrameHeight!=fBetterFrameHeight )
|
if( fFrameWidth!=fBetterFrameWidth || fFrameHeight!=fBetterFrameHeight )
|
||||||
{
|
{
|
||||||
RString sWarning = ssprintf(
|
RString sWarning = ssprintf(
|
||||||
"The graphic '%s' has frame dimensions that aren't even numbers.\n"
|
"The graphic '%s' has frame dimensions that aren't a multiple of %d.\n"
|
||||||
"The entire image is %dx%d and frame size is %.1fx%.1f.\n"
|
"The entire image is %dx%d and frame size is %.1fx%.1f.\n"
|
||||||
"Image quality will be much improved if you resize the graphic to %.0fx%.0f, which is a frame size of %.0fx%.0f.",
|
"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(),
|
actualID.filename.c_str(),
|
||||||
|
iDimensionMultiple,
|
||||||
this->GetSourceWidth(), this->GetSourceHeight(),
|
this->GetSourceWidth(), this->GetSourceHeight(),
|
||||||
fFrameWidth, fFrameHeight,
|
fFrameWidth, fFrameHeight,
|
||||||
fBetterSourceWidth, fBetterSourceHeight,
|
fBetterSourceWidth, fBetterSourceHeight,
|
||||||
@@ -276,14 +285,20 @@ void RageBitmapTexture::Create()
|
|||||||
Dialog::OK( sWarning, "FRAME_DIMENSIONS_WARNING" );
|
Dialog::OK( sWarning, "FRAME_DIMENSIONS_WARNING" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
delete pImg;
|
delete pImg;
|
||||||
|
|
||||||
/* See if the apparent "size" is being overridden. */
|
/* Check for hints that override the apparent "size". */
|
||||||
GetResolutionFromFileName( actualID.filename, m_iSourceWidth, m_iSourceHeight );
|
GetResolutionFromFileName( actualID.filename, m_iSourceWidth, m_iSourceHeight );
|
||||||
|
|
||||||
|
if( sHintString.find("doubleres") != string::npos )
|
||||||
|
{
|
||||||
|
m_iSourceWidth = m_iSourceWidth / 2;
|
||||||
|
m_iSourceHeight = m_iSourceHeight / 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
RString sProperties;
|
RString sProperties;
|
||||||
sProperties += PixelFormatToString( pixfmt ) + " ";
|
sProperties += PixelFormatToString( pixfmt ) + " ";
|
||||||
|
|||||||
Reference in New Issue
Block a user