1
0
mirror of https://github.com/wolfpld/tracy synced 2025-05-03 06:03:51 +00:00

Scale frame images in tooltips according to DPI scaling.

This commit is contained in:
Bartosz Taudul 2019-11-16 22:58:51 +01:00
parent 2d22372de3
commit 8ca67e49e4

View File

@ -1102,7 +1102,8 @@ void View::DrawFrames()
{ {
assert( m_worker.GetFrameCount( *m_frames ) != 0 ); assert( m_worker.GetFrameCount( *m_frames ) != 0 );
const auto Height = 50 * ImGui::GetTextLineHeight() / 15.f; const auto scale = ImGui::GetTextLineHeight() / 15.f;
const auto Height = 50 * scale;
enum { MaxFrameTime = 50 * 1000 * 1000 }; // 50ms enum { MaxFrameTime = 50 * 1000 * 1000 }; // 50ms
@ -1252,11 +1253,11 @@ void View::DrawFrames()
ImGui::Separator(); ImGui::Separator();
if( fi->flip ) if( fi->flip )
{ {
ImGui::Image( m_frameTexture, ImVec2( fi->w, fi->h ), ImVec2( 0, 1 ), ImVec2( 1, 0 ) ); ImGui::Image( m_frameTexture, ImVec2( fi->w * scale, fi->h * scale ), ImVec2( 0, 1 ), ImVec2( 1, 0 ) );
} }
else else
{ {
ImGui::Image( m_frameTexture, ImVec2( fi->w, fi->h ) ); ImGui::Image( m_frameTexture, ImVec2( fi->w * scale, fi->h * scale ) );
} }
} }
ImGui::EndTooltip(); ImGui::EndTooltip();
@ -1795,6 +1796,7 @@ bool View::DrawZoneFrames( const FrameData& frames )
auto fi = m_worker.GetFrameImage( frames, i ); auto fi = m_worker.GetFrameImage( frames, i );
if( fi ) if( fi )
{ {
const auto scale = ImGui::GetTextLineHeight() / 15.f;
if( fi != m_frameTexturePtr ) if( fi != m_frameTexturePtr )
{ {
if( !m_frameTexture ) m_frameTexture = MakeTexture(); if( !m_frameTexture ) m_frameTexture = MakeTexture();
@ -1804,11 +1806,11 @@ bool View::DrawZoneFrames( const FrameData& frames )
ImGui::Separator(); ImGui::Separator();
if( fi->flip ) if( fi->flip )
{ {
ImGui::Image( m_frameTexture, ImVec2( fi->w, fi->h ), ImVec2( 0, 1 ), ImVec2( 1, 0 ) ); ImGui::Image( m_frameTexture, ImVec2( fi->w * scale, fi->h * scale ), ImVec2( 0, 1 ), ImVec2( 1, 0 ) );
} }
else else
{ {
ImGui::Image( m_frameTexture, ImVec2( fi->w, fi->h ) ); ImGui::Image( m_frameTexture, ImVec2( fi->w * scale, fi->h * scale ) );
} }
if( ImGui::GetIO().KeyCtrl && ImGui::IsMouseClicked( 0 ) ) if( ImGui::GetIO().KeyCtrl && ImGui::IsMouseClicked( 0 ) )