Display thumbnail of current frame image in connection popup.

This commit is contained in:
Bartosz Taudul 2020-07-30 01:58:08 +02:00
parent f367b16dc0
commit 0d2914bbe8
2 changed files with 26 additions and 0 deletions

View File

@ -1115,6 +1115,29 @@ bool View::DrawConnection()
} }
} }
const auto& fis = m_worker.GetFrameImages();
if( !fis.empty() )
{
const auto scale = ImGui::GetTextLineHeight() / 15.f * 0.5f;
const auto& fi = fis.back();
if( fi != m_frameTextureConnPtr )
{
if( !m_frameTextureConn ) m_frameTextureConn = MakeTexture();
UpdateTexture( m_frameTextureConn, m_worker.UnpackFrameImage( *fi ), fi->w, fi->h );
m_frameTextureConnPtr = fi;
}
ImGui::Separator();
if( fi->flip )
{
ImGui::Image( m_frameTextureConn, ImVec2( fi->w * scale, fi->h * scale ), ImVec2( 0, 1 ), ImVec2( 1, 0 ) );
}
else
{
ImGui::Image( m_frameTextureConn, ImVec2( fi->w * scale, fi->h * scale ) );
}
}
ImGui::Separator();
if( ImGui::Button( ICON_FA_SAVE " Save trace" ) && m_saveThreadState.load( std::memory_order_relaxed ) == SaveThreadState::Inert ) if( ImGui::Button( ICON_FA_SAVE " Save trace" ) && m_saveThreadState.load( std::memory_order_relaxed ) == SaveThreadState::Inert )
{ {
#ifndef TRACY_NO_FILESELECTOR #ifndef TRACY_NO_FILESELECTOR

View File

@ -454,6 +454,9 @@ private:
void* m_frameTexture = nullptr; void* m_frameTexture = nullptr;
const void* m_frameTexturePtr = nullptr; const void* m_frameTexturePtr = nullptr;
void* m_frameTextureConn = nullptr;
const void* m_frameTextureConnPtr = nullptr;
std::vector<std::unique_ptr<Annotation>> m_annotations; std::vector<std::unique_ptr<Annotation>> m_annotations;
UserData m_userData; UserData m_userData;