FontPageSettings is a complex type; avoid unneeded copying

This commit is contained in:
Glenn Maynard
2005-08-26 18:33:42 +00:00
parent 9b307b198c
commit db92df2fe1
2 changed files with 9 additions and 8 deletions
+8 -7
View File
@@ -22,7 +22,7 @@ FontPage::FontPage()
m_iDrawExtraPixelsLeft = m_iDrawExtraPixelsRight = 0;
}
void FontPage::Load( FontPageSettings cfg )
void FontPage::Load( const FontPageSettings &cfg )
{
m_sTexturePath = cfg.m_sTexturePath;
@@ -74,19 +74,20 @@ void FontPage::Load( FontPageSettings cfg )
int iBaseline=0;
/* If we don't have a top and/or baseline, assume we're centered in the
* frame, and that LineSpacing is the total height. */
if( cfg.m_iBaseline == -1 )
iBaseline = cfg.m_iBaseline;
if( iBaseline == -1 )
{
float center = m_pTexture->GetSourceFrameHeight()/2.0f;
cfg.m_iBaseline = int( center + m_iLineSpacing/2 );
iBaseline = int( center + m_iLineSpacing/2 );
}
if( cfg.m_iTop == -1 )
int iTop = cfg.m_iTop;
if( iTop == -1 )
{
float center = m_pTexture->GetSourceFrameHeight()/2.0f;
cfg.m_iTop = int( center - m_iLineSpacing/2 );
iTop = int( center - m_iLineSpacing/2 );
}
iBaseline = cfg.m_iBaseline;
m_iHeight = iBaseline - cfg.m_iTop;
m_iHeight = iBaseline - iTop;
m_iDrawExtraPixelsLeft = cfg.m_iDrawExtraPixelsLeft;
m_iDrawExtraPixelsRight = cfg.m_iDrawExtraPixelsRight;
+1 -1
View File
@@ -73,7 +73,7 @@ public:
FontPage();
~FontPage();
void Load( FontPageSettings cfg );
void Load( const FontPageSettings &cfg );
/* Page-global properties. */
int m_iHeight;