Delay creation of frame image texture.

This commit is contained in:
Bartosz Taudul 2019-06-06 23:14:49 +02:00
parent 129155946b
commit 9cd95db4e3
2 changed files with 4 additions and 6 deletions

View File

@ -419,8 +419,6 @@ View::View( const char* addr, ImFont* fixedWidth, SetTitleCallback stcb )
assert( s_instance == nullptr ); assert( s_instance == nullptr );
s_instance = this; s_instance = this;
m_frameTexture = MakeTexture();
InitTextEditor(); InitTextEditor();
} }
@ -438,8 +436,6 @@ View::View( FileRead& f, ImFont* fixedWidth, SetTitleCallback stcb )
m_notificationTime = 4; m_notificationTime = 4;
m_notificationText = std::string( "Trace loaded in " ) + TimeToString( m_worker.GetLoadTime() ); m_notificationText = std::string( "Trace loaded in " ) + TimeToString( m_worker.GetLoadTime() );
m_frameTexture = MakeTexture();
InitTextEditor(); InitTextEditor();
SetViewToLastFrames(); SetViewToLastFrames();
} }
@ -451,7 +447,7 @@ View::~View()
if( m_compare.loadThread.joinable() ) m_compare.loadThread.join(); if( m_compare.loadThread.joinable() ) m_compare.loadThread.join();
if( m_saveThread.joinable() ) m_saveThread.join(); if( m_saveThread.joinable() ) m_saveThread.join();
FreeTexture( m_frameTexture ); if( m_frameTexture ) FreeTexture( m_frameTexture );
assert( s_instance != nullptr ); assert( s_instance != nullptr );
s_instance = nullptr; s_instance = nullptr;
@ -1274,6 +1270,7 @@ void View::DrawFrames()
{ {
if( fi != m_frameTexturePtr ) if( fi != m_frameTexturePtr )
{ {
if( !m_frameTexture ) m_frameTexture = MakeTexture();
UpdateTexture( m_frameTexture, fi->ptr, fi->w, fi->h ); UpdateTexture( m_frameTexture, fi->ptr, fi->w, fi->h );
m_frameTexturePtr = fi; m_frameTexturePtr = fi;
} }
@ -1661,6 +1658,7 @@ bool View::DrawZoneFrames( const FrameData& frames )
{ {
if( fi != m_frameTexturePtr ) if( fi != m_frameTexturePtr )
{ {
if( !m_frameTexture ) m_frameTexture = MakeTexture();
UpdateTexture( m_frameTexture, fi->ptr, fi->w, fi->h ); UpdateTexture( m_frameTexture, fi->ptr, fi->w, fi->h );
m_frameTexturePtr = fi; m_frameTexturePtr = fi;
} }

View File

@ -327,7 +327,7 @@ private:
std::atomic<SaveThreadState> m_saveThreadState { SaveThreadState::Inert }; std::atomic<SaveThreadState> m_saveThreadState { SaveThreadState::Inert };
std::thread m_saveThread; std::thread m_saveThread;
void* m_frameTexture; void* m_frameTexture = nullptr;
const void* m_frameTexturePtr = nullptr; const void* m_frameTexturePtr = nullptr;
struct FindZone { struct FindZone {