Optional frame image display in messages list.

This commit is contained in:
Bartosz Taudul 2020-02-24 01:29:57 +01:00
parent d63a15a570
commit 2e3b13ced5
2 changed files with 37 additions and 0 deletions

View File

@ -8040,6 +8040,17 @@ void View::DrawMessages()
ImGui::Spacing();
ImGui::SameLine();
TextFocused( "Visible messages:", RealToString( m_visibleMessages ) );
if( m_worker.GetFrameImageCount() != 0 )
{
ImGui::SameLine();
ImGui::Spacing();
ImGui::SameLine();
#ifdef TRACY_EXTENDED_FONT
ImGui::Checkbox( ICON_FA_IMAGE " Show frame images", &m_showMessageImages );
#else
ImGui::Checkbox( "Show frame images", &m_showMessageImages );
#endif
}
#ifdef TRACY_EXTENDED_FONT
auto expand = ImGui::TreeNode( ICON_FA_RANDOM " Visible threads:" );
@ -8146,6 +8157,31 @@ void View::DrawMessages()
if( ImGui::IsItemHovered() )
{
m_msgHighlight = v;
if( m_showMessageImages )
{
const auto frameIdx = m_worker.GetFrameRange( *m_frames, v->time, v->time ).first;
auto fi = m_worker.GetFrameImage( *m_frames, frameIdx );
if( fi )
{
ImGui::BeginTooltip();
if( fi != m_frameTexturePtr )
{
if( !m_frameTexture ) m_frameTexture = MakeTexture();
UpdateTexture( m_frameTexture, m_worker.UnpackFrameImage( *fi ), fi->w, fi->h );
m_frameTexturePtr = fi;
}
if( fi->flip )
{
ImGui::Image( m_frameTexture, ImVec2( fi->w, fi->h ), ImVec2( 0, 1 ), ImVec2( 1, 0 ) );
}
else
{
ImGui::Image( m_frameTexture, ImVec2( fi->w, fi->h ) );
}
ImGui::EndTooltip();
}
}
}
if( m_msgToFocus == v )
{

View File

@ -305,6 +305,7 @@ private:
int m_frameHover = -1;
bool m_messagesScrollBottom;
ImGuiTextFilter m_messageFilter;
bool m_showMessageImages = false;
ImGuiTextFilter m_statisticsFilter;
int m_visibleMessages = 0;
bool m_disconnectIssued = false;