Only iterate over the section of a hold note that's on screen. Fixes slowness
with extremely long hold notes; now, even if a hold note has a MAX_NOTE_ROW duration (which would be a bug), we shouldn't slow down.
This commit is contained in:
@@ -669,7 +669,8 @@ void NoteDisplay::DrawHoldTopCap( const TapNote& tn, int iCol, int iBeat, const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void NoteDisplay::DrawHoldBody( const TapNote& tn, int iCol, int iBeat, const bool bIsBeingHeld, float fYHead, float fYTail, int fYStep, float fPercentFadeToFail, float fColorScale, bool bGlow )
|
void NoteDisplay::DrawHoldBody( const TapNote& tn, int iCol, int iBeat, const bool bIsBeingHeld, float fYHead, float fYTail, int fYStep, float fPercentFadeToFail, float fColorScale, bool bGlow,
|
||||||
|
float fYStartOffset, float fYEndOffset )
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Draw the body (always wavy)
|
// Draw the body (always wavy)
|
||||||
@@ -701,14 +702,29 @@ void NoteDisplay::DrawHoldBody( const TapNote& tn, int iCol, int iBeat, const bo
|
|||||||
if( bGlow )
|
if( bGlow )
|
||||||
fColorScale = 1;
|
fColorScale = 1;
|
||||||
|
|
||||||
|
/* Only draw the section that's within the range specified. If a hold note is
|
||||||
|
* very long, don't process or draw the part outside of the range. Don't change
|
||||||
|
* fYBodyTop or fYBodyBottom; they need to be left alone to calculate texture
|
||||||
|
* coordinates. */
|
||||||
|
float fDrawYBodyTop;
|
||||||
|
float fDrawYBodyBottom;
|
||||||
|
{
|
||||||
|
float fYStartPos = ArrowEffects::GetYPos( m_pPlayerState, iCol, fYStartOffset, m_fYReverseOffsetPixels );
|
||||||
|
fDrawYBodyTop = max( fYBodyTop, fYStartPos );
|
||||||
|
}
|
||||||
|
{
|
||||||
|
float fYEndPos = ArrowEffects::GetYPos( m_pPlayerState, iCol, fYEndOffset, m_fYReverseOffsetPixels );
|
||||||
|
fDrawYBodyBottom = min( fYBodyBottom, fYEndPos );
|
||||||
|
}
|
||||||
|
|
||||||
// top to bottom
|
// top to bottom
|
||||||
bool bAllAreTransparent = true;
|
bool bAllAreTransparent = true;
|
||||||
bool bLast = false;
|
bool bLast = false;
|
||||||
for( float fY = fYBodyTop; !bLast; fY += fYStep )
|
for( float fY = fDrawYBodyTop; !bLast; fY += fYStep )
|
||||||
{
|
{
|
||||||
if( fY >= fYBodyBottom )
|
if( fY >= fDrawYBodyBottom )
|
||||||
{
|
{
|
||||||
fY = fYBodyBottom;
|
fY = fDrawYBodyBottom;
|
||||||
bLast = true;
|
bLast = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -926,7 +942,7 @@ void NoteDisplay::DrawHoldHead( const TapNote& tn, int iCol, int iBeat, const bo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void NoteDisplay::DrawHold( const TapNote &tn, int iCol, int iBeat, bool bIsBeingHeld, bool bIsActive, const HoldNoteResult &Result, float fPercentFadeToFail, bool bDrawGlowOnly, float fReverseOffsetPixels )
|
void NoteDisplay::DrawHold( const TapNote &tn, int iCol, int iBeat, bool bIsBeingHeld, bool bIsActive, const HoldNoteResult &Result, float fPercentFadeToFail, bool bDrawGlowOnly, float fReverseOffsetPixels, float fYStartOffset, float fYEndOffset )
|
||||||
{
|
{
|
||||||
int iEndBeat = iBeat + tn.iDuration;
|
int iEndBeat = iBeat + tn.iDuration;
|
||||||
|
|
||||||
@@ -972,7 +988,7 @@ void NoteDisplay::DrawHold( const TapNote &tn, int iCol, int iBeat, bool bIsBein
|
|||||||
|
|
||||||
if( !bFlipHeadAndTail )
|
if( !bFlipHeadAndTail )
|
||||||
DrawHoldBottomCap( tn, iCol, iBeat, bIsBeingHeld, fYHead, fYTail, fYStep, fPercentFadeToFail, fColorScale, bDrawGlowOnly );
|
DrawHoldBottomCap( tn, iCol, iBeat, bIsBeingHeld, fYHead, fYTail, fYStep, fPercentFadeToFail, fColorScale, bDrawGlowOnly );
|
||||||
DrawHoldBody( tn, iCol, iBeat, bIsBeingHeld, fYHead, fYTail, fYStep, fPercentFadeToFail, fColorScale, bDrawGlowOnly );
|
DrawHoldBody( tn, iCol, iBeat, bIsBeingHeld, fYHead, fYTail, fYStep, fPercentFadeToFail, fColorScale, bDrawGlowOnly, fYStartOffset, fYEndOffset );
|
||||||
if( bFlipHeadAndTail )
|
if( bFlipHeadAndTail )
|
||||||
DrawHoldTopCap( tn, iCol, iBeat, bIsBeingHeld, fYHead, fYTail, fYStep, fPercentFadeToFail, fColorScale, bDrawGlowOnly );
|
DrawHoldTopCap( tn, iCol, iBeat, bIsBeingHeld, fYHead, fYTail, fYStep, fPercentFadeToFail, fColorScale, bDrawGlowOnly );
|
||||||
|
|
||||||
@@ -984,7 +1000,7 @@ void NoteDisplay::DrawHold( const TapNote &tn, int iCol, int iBeat, bool bIsBein
|
|||||||
|
|
||||||
// now, draw the glow pass
|
// now, draw the glow pass
|
||||||
if( !bDrawGlowOnly )
|
if( !bDrawGlowOnly )
|
||||||
DrawHold( tn, iCol, iBeat, bIsBeingHeld, bIsActive, Result, fPercentFadeToFail, true, fReverseOffsetPixels );
|
DrawHold( tn, iCol, iBeat, bIsBeingHeld, bIsActive, Result, fPercentFadeToFail, true, fReverseOffsetPixels, fYStartOffset, fYEndOffset );
|
||||||
}
|
}
|
||||||
|
|
||||||
void NoteDisplay::DrawActor( Actor* pActor, int iCol, float fBeat, float fPercentFadeToFail, float fLife, float fReverseOffsetPixels, bool bUseLighting )
|
void NoteDisplay::DrawActor( Actor* pActor, int iCol, float fBeat, float fPercentFadeToFail, float fLife, float fReverseOffsetPixels, bool bUseLighting )
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public:
|
|||||||
|
|
||||||
void DrawActor( Actor* pActor, int iCol, float fBeat, float fPercentFadeToFail, float fLife, float fReverseOffsetPixels, bool bUseLighting );
|
void DrawActor( Actor* pActor, int iCol, float fBeat, float fPercentFadeToFail, float fLife, float fReverseOffsetPixels, bool bUseLighting );
|
||||||
void DrawTap( int iCol, float fBeat, bool bOnSameRowAsHoldStart, bool bIsAddition, bool bIsMine, float fPercentFadeToFail, float fLife, float fReverseOffsetPixels );
|
void DrawTap( int iCol, float fBeat, bool bOnSameRowAsHoldStart, bool bIsAddition, bool bIsMine, float fPercentFadeToFail, float fLife, float fReverseOffsetPixels );
|
||||||
void DrawHold( const TapNote& tn, int iCol, int iBeat, bool bIsBeingHeld, bool bIsActive, const HoldNoteResult &Result, float fPercentFadeToFail, bool bDrawGlowOnly, float fReverseOffsetPixels );
|
void DrawHold( const TapNote& tn, int iCol, int iBeat, bool bIsBeingHeld, bool bIsActive, const HoldNoteResult &Result, float fPercentFadeToFail, bool bDrawGlowOnly, float fReverseOffsetPixels, float fYStartOffset, float fYEndOffset );
|
||||||
|
|
||||||
bool DrawHoldHeadForTapsOnSameRow() const;
|
bool DrawHoldHeadForTapsOnSameRow() const;
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ protected:
|
|||||||
|
|
||||||
void DrawHoldBottomCap( const TapNote& tn, int iCol, int iBeat, const bool bIsBeingHeld, float fYHead, float fYTail, int fYStep, float fPercentFadeToFail, float fColorScale, bool bGlow );
|
void DrawHoldBottomCap( const TapNote& tn, int iCol, int iBeat, const bool bIsBeingHeld, float fYHead, float fYTail, int fYStep, float fPercentFadeToFail, float fColorScale, bool bGlow );
|
||||||
void DrawHoldTopCap( const TapNote& tn, int iCol, int iBeat, const bool bIsBeingHeld, float fYHead, float fYTail, int fYStep, float fPercentFadeToFail, float fColorScale, bool bGlow );
|
void DrawHoldTopCap( const TapNote& tn, int iCol, int iBeat, const bool bIsBeingHeld, float fYHead, float fYTail, int fYStep, float fPercentFadeToFail, float fColorScale, bool bGlow );
|
||||||
void DrawHoldBody( const TapNote& tn, int iCol, int iBeat, const bool bIsBeingHeld, float fYHead, float fYTail, int fYStep, float fPercentFadeToFail, float fColorScale, bool bGlow );
|
void DrawHoldBody( const TapNote& tn, int iCol, int iBeat, const bool bIsBeingHeld, float fYHead, float fYTail, int fYStep, float fPercentFadeToFail, float fColorScale, bool bGlow, float fYStartOffset, float fYEndOffset );
|
||||||
void DrawHoldTail( const TapNote& tn, int iCol, int iBeat, const bool bIsBeingHeld, float fYTail, float fPercentFadeToFail, float fColorScale, bool bGlow );
|
void DrawHoldTail( const TapNote& tn, int iCol, int iBeat, const bool bIsBeingHeld, float fYTail, float fPercentFadeToFail, float fColorScale, bool bGlow );
|
||||||
void DrawHoldHead( const TapNote& tn, int iCol, int iBeat, const bool bIsBeingHeld, float fYHead, float fPercentFadeToFail, float fColorScale, bool bGlow );
|
void DrawHoldHead( const TapNote& tn, int iCol, int iBeat, const bool bIsBeingHeld, float fYHead, float fPercentFadeToFail, float fColorScale, bool bGlow );
|
||||||
|
|
||||||
|
|||||||
@@ -601,7 +601,7 @@ void NoteField::DrawPrimitives()
|
|||||||
bIsInSelectionRange = (m_iBeginMarker <= iStartRow && iEndRow < m_iEndMarker);
|
bIsInSelectionRange = (m_iBeginMarker <= iStartRow && iEndRow < m_iEndMarker);
|
||||||
|
|
||||||
NoteDisplayCols *nd = CurDisplay->second;
|
NoteDisplayCols *nd = CurDisplay->second;
|
||||||
nd->display[c].DrawHold( tn, c, iStartRow, bIsHoldingNote, bIsActive, Result, bIsInSelectionRange ? fSelectedRangeGlow : m_fPercentFadeToFail, false, m_fYReverseOffsetPixels );
|
nd->display[c].DrawHold( tn, c, iStartRow, bIsHoldingNote, bIsActive, Result, bIsInSelectionRange ? fSelectedRangeGlow : m_fPercentFadeToFail, false, m_fYReverseOffsetPixels, (float) iFirstPixelToDraw, (float) iLastPixelToDraw );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user