mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-26 07:54:36 +00:00
Calc frame width and grouping in separate functions.
This commit is contained in:
parent
ab16b66265
commit
9b93fea0f5
@ -423,6 +423,16 @@ static ImU32 GetFrameColor( uint64_t frameTime )
|
|||||||
frameTime > BestTime ? 0xFF22DD22 : 0xFFDD9900;
|
frameTime > BestTime ? 0xFF22DD22 : 0xFFDD9900;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int GetFrameWidth( int frameScale )
|
||||||
|
{
|
||||||
|
return frameScale == 0 ? 4 : ( frameScale == -1 ? 6 : 1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
static int GetFrameGroup( int frameScale )
|
||||||
|
{
|
||||||
|
return frameScale < 2 ? 1 : ( 1 << ( frameScale - 1 ) );
|
||||||
|
}
|
||||||
|
|
||||||
void View::DrawFrames()
|
void View::DrawFrames()
|
||||||
{
|
{
|
||||||
enum { Offset = 25 };
|
enum { Offset = 25 };
|
||||||
@ -454,8 +464,8 @@ void View::DrawFrames()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const int fwidth = m_frameScale == 0 ? 4 : ( m_frameScale == -1 ? 6 : 1 );
|
const int fwidth = GetFrameWidth( m_frameScale );
|
||||||
const int group = m_frameScale < 2 ? 1 : ( 1 << ( m_frameScale - 1 ) );
|
const int group = GetFrameGroup( m_frameScale );
|
||||||
const int total = m_frames.size();
|
const int total = m_frames.size();
|
||||||
const int onScreen = ( w - 2 ) / fwidth;
|
const int onScreen = ( w - 2 ) / fwidth;
|
||||||
if( !m_pause ) m_frameStart = ( total < onScreen * group ) ? 0 : total - onScreen * group;
|
if( !m_pause ) m_frameStart = ( total < onScreen * group ) ? 0 : total - onScreen * group;
|
||||||
|
Loading…
Reference in New Issue
Block a user