Revert. I will probally revert further/manually undo some changes.
This commit is contained in:
@@ -367,24 +367,9 @@ void BitmapText::SetText( const CString& _sText, const CString& _sAlternateText,
|
||||
m_vColors.clear();
|
||||
|
||||
int i = m_sText.Find( "|c0", 0 );
|
||||
int last = 0, iNewlineCount = -3;
|
||||
|
||||
int last = 0;
|
||||
while ( ( i > -1 ) && ( i < ( int( m_sText.length() ) - 9 ) ) )
|
||||
{
|
||||
int j = m_sText.Find( CString("\n"), last+1 );
|
||||
//Count \n's from previous to now.
|
||||
|
||||
LOG->Info("M4");
|
||||
|
||||
while ( ( j < i ) && ( j >= 0 ) )
|
||||
{
|
||||
j = m_sText.Find( CString("\n"), j+1 );
|
||||
iNewlineCount+=2;
|
||||
}
|
||||
|
||||
|
||||
LOG->Info("M5");
|
||||
|
||||
sEndText += m_sText.substr( last, i-last );
|
||||
ColorChange change;
|
||||
int k;
|
||||
@@ -392,7 +377,7 @@ void BitmapText::SetText( const CString& _sText, const CString& _sAlternateText,
|
||||
sscanf( m_sText.substr( i+5, 2 ).c_str(), "%x", &k ); change.c.g = float( k ) / 255.0f;
|
||||
sscanf( m_sText.substr( i+7, 2 ).c_str(), "%x", &k ); change.c.b = float( k ) / 255.0f;
|
||||
change.c.a = 1;
|
||||
change.l = sEndText.length() - MAX( iNewlineCount, 0 );
|
||||
change.l = sEndText.length();
|
||||
m_vColors.push_back( change );
|
||||
last = i+9;
|
||||
if ( last < (int)m_sText.length() )
|
||||
@@ -598,42 +583,6 @@ bool BitmapText::StringWillUseAlternate( const CString& sText, const CString& sA
|
||||
return true;
|
||||
}
|
||||
|
||||
void BitmapText::SetMaxLines( int iNumLines, int iDirection )
|
||||
{
|
||||
iNumLines = max( 0, iNumLines );
|
||||
iNumLines = min( (int)m_wTextLines.size(), iNumLines );
|
||||
if( iDirection == 0 )
|
||||
{
|
||||
// Crop all bottom lines
|
||||
m_wTextLines.resize( iNumLines );
|
||||
m_iLineWidths.resize( iNumLines );
|
||||
}
|
||||
else
|
||||
{
|
||||
//Because colors are relative to the beginning, we have to crop them back
|
||||
unsigned shift = 0;
|
||||
|
||||
LOG->Info("M1");
|
||||
for ( unsigned i = 0; i < m_wTextLines.size() - iNumLines; i++ )
|
||||
shift += m_wTextLines[i].length();
|
||||
|
||||
for ( unsigned i = 0; i < m_vColors.size(); i++ )
|
||||
{
|
||||
m_vColors[i].l -= shift;
|
||||
if ( m_vColors[i].l < 0 )
|
||||
{
|
||||
m_vColors.erase( m_vColors.begin() + i );
|
||||
i--;
|
||||
}
|
||||
}
|
||||
LOG->Info("M2");
|
||||
|
||||
m_wTextLines.erase( m_wTextLines.begin(), m_wTextLines.end() - iNumLines );
|
||||
m_iLineWidths.erase( m_iLineWidths.begin(), m_iLineWidths.end() - iNumLines );
|
||||
}
|
||||
BuildChars();
|
||||
}
|
||||
|
||||
void BitmapText::CropToWidth( int iMaxWidthInSourcePixels )
|
||||
{
|
||||
iMaxWidthInSourcePixels = max( 0, iMaxWidthInSourcePixels );
|
||||
|
||||
Reference in New Issue
Block a user