Calculate zone area to display.

This commit is contained in:
Bartosz Taudul 2017-09-20 21:21:21 +02:00
parent c9aaa03b28
commit efc7958ae0
2 changed files with 13 additions and 1 deletions

View File

@ -32,6 +32,8 @@ View::View( const char* addr )
, m_frameScale( 0 )
, m_pause( false )
, m_frameStart( 0 )
, m_zvStart( 0 )
, m_zvEnd( 0 )
{
assert( s_instance == nullptr );
s_instance = this;
@ -448,6 +450,8 @@ static int GetFrameGroup( int frameScale )
void View::DrawFrames()
{
assert( !m_frames.empty() );
enum { Height = 40 };
enum { MaxFrameTime = 50 * 1000 * 1000 }; // 50ms
@ -483,7 +487,12 @@ void View::DrawFrames()
const int group = GetFrameGroup( m_frameScale );
const int total = m_frames.size();
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;
m_zvStart = m_frames[std::max( 0, (int)m_frames.size() - 3 )];
m_zvEnd = m_frames.back();
}
if( hover )
{

View File

@ -86,6 +86,9 @@ private:
int m_frameScale;
bool m_pause;
int m_frameStart;
uint64_t m_zvStart;
uint64_t m_zvEnd;
};
}