fix 'no stroke draws if any Font doesn't have a stroke texture'

This commit is contained in:
Chris Danford
2008-06-30 09:36:48 +00:00
parent 57b20c65fd
commit 19c4dc99d9
+19 -15
View File
@@ -331,21 +331,26 @@ void BitmapText::DrawChars( bool bUseStrokeTexture )
int end = start; int end = start;
while( end < iEndGlyph && m_vpFontPageTextures[end] == m_vpFontPageTextures[start] ) while( end < iEndGlyph && m_vpFontPageTextures[end] == m_vpFontPageTextures[start] )
end++; end++;
DISPLAY->ClearAllTextures();
if( bUseStrokeTexture && m_vpFontPageTextures[start]->m_pTextureStroke )
DISPLAY->SetTexture( TextureUnit_1, m_vpFontPageTextures[start]->m_pTextureStroke->GetTexHandle() );
else
DISPLAY->SetTexture( TextureUnit_1, m_vpFontPageTextures[start]->m_pTextureMain->GetTexHandle() );
/* Don't bother setting texture render states for text. We never go outside of 0..1. */ bool bHaveATexture = !bUseStrokeTexture || (bUseStrokeTexture && m_vpFontPageTextures[start]->m_pTextureStroke);
/* We should call SetTextureRenderStates because it does more than just setting if( bHaveATexture )
* the texture wrapping state. If setting the wrapping state is found to be slow, {
* there should probably be a "don't care" texture wrapping mode set in Actor. -Chris */ DISPLAY->ClearAllTextures();
Actor::SetTextureRenderStates(); if( bUseStrokeTexture )
DISPLAY->SetTexture( TextureUnit_1, m_vpFontPageTextures[start]->m_pTextureStroke->GetTexHandle() );
else
DISPLAY->SetTexture( TextureUnit_1, m_vpFontPageTextures[start]->m_pTextureMain->GetTexHandle() );
RageSpriteVertex &start_vertex = m_aVertices[start*4]; /* Don't bother setting texture render states for text. We never go outside of 0..1. */
int iNumVertsToDraw = (end-start)*4; /* We should call SetTextureRenderStates because it does more than just setting
DISPLAY->DrawQuads( &start_vertex, iNumVertsToDraw ); * the texture wrapping state. If setting the wrapping state is found to be slow,
* there should probably be a "don't care" texture wrapping mode set in Actor. -Chris */
Actor::SetTextureRenderStates();
RageSpriteVertex &start_vertex = m_aVertices[start*4];
int iNumVertsToDraw = (end-start)*4;
DISPLAY->DrawQuads( &start_vertex, iNumVertsToDraw );
}
start = end; start = end;
} }
@@ -533,8 +538,7 @@ bool BitmapText::EarlyAbortDraw() const
} }
#define DRAW_STROKE \ #define DRAW_STROKE \
bool bUsingStrokeTexture = !!m_vpFontPageTextures[0]->m_pTextureStroke; \ if( m_StrokeColor.a > 0 ) \
if( bUsingStrokeTexture && m_StrokeColor.a > 0 ) \
{ \ { \
RageColor c = m_StrokeColor; \ RageColor c = m_StrokeColor; \
c.a *= m_pTempState->diffuse[0].a; \ c.a *= m_pTempState->diffuse[0].a; \