More compact locks drawing.

This commit is contained in:
Bartosz Taudul 2022-07-24 00:13:11 +02:00
parent efaf1df8d4
commit 0a00925a9b
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3
2 changed files with 10 additions and 6 deletions

View File

@ -259,7 +259,9 @@ void View::DrawLockHeader( uint32_t id, const LockMap& lockmap, const SourceLoca
{
sprintf( buf, "%" PRIu32 ": %s", id, m_worker.GetString( srcloc.function ) );
}
ImGui::PushFont( m_smallFont );
DrawTextContrast( draw, wpos + ImVec2( 0, offset ), 0xFF8888FF, buf );
ImGui::PopFont();
if( hover && ImGui::IsMouseHoveringRect( wpos + ImVec2( 0, offset ), wpos + ImVec2( w, offset + ty + 1 ) ) )
{
m_lockHoverHighlight = id;
@ -342,7 +344,9 @@ int View::DrawLocks( uint64_t tid, bool hover, double pxns, const ImVec2& wpos,
const auto delay = m_worker.GetDelay();
const auto resolution = m_worker.GetResolution();
const auto w = ImGui::GetContentRegionAvail().x - 1;
ImGui::PushFont( m_smallFont );
const auto ty = ImGui::GetTextLineHeight();
ImGui::PopFont();
const auto ostep = ty + 1;
auto draw = ImGui::GetWindowDrawList();
const auto dsz = delay * pxns;

View File

@ -293,6 +293,11 @@ void View::DrawTimeline()
const auto nspx = 1.0 / pxns;
ImGui::PushFont( m_smallFont );
const auto sty = ImGui::GetTextLineHeight();
const auto sstep = sty + 1;
ImGui::PopFont();
const auto ty = ImGui::GetTextLineHeight();
const auto ostep = ty + 1;
int offset = 0;
@ -318,11 +323,6 @@ void View::DrawTimeline()
const auto oldOffset = offset;
ImGui::PushClipRect( wpos, wpos + ImVec2( w, oldOffset + vis.height ), true );
ImGui::PushFont( m_smallFont );
const auto sty = ImGui::GetTextLineHeight();
const auto sstep = sty + 1;
ImGui::PopFont();
const auto singleThread = v->threadData.size() == 1;
int depth = 0;
offset += ostep;
@ -663,7 +663,7 @@ void View::DrawTimeline()
if( m_vd.drawLocks )
{
const auto lockDepth = DrawLocks( v->id, hover, pxns, wpos, offset, nextLockHighlight, yMin, yMax );
offset += ostep * lockDepth;
offset += sstep * lockDepth;
depth += lockDepth;
}
}