mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 02:31:48 +00:00
Fix zone size calculation wrt text fitting.
Previously the zone size calculation hasn't took into account the possibility of the zone going out of the screen. This is now fixed.
This commit is contained in:
parent
7f99ee2c13
commit
63d074c5d8
@ -60,7 +60,7 @@ int View::DrawGhostLevel( const Vector<GhostZone>& vec, bool hover, double pxns,
|
|||||||
{
|
{
|
||||||
auto& ev = *it;
|
auto& ev = *it;
|
||||||
const auto end = ev.end.Val();
|
const auto end = ev.end.Val();
|
||||||
const auto zsz = std::max( ( end - ev.start.Val() ) * pxns, pxns * 0.5 );
|
const auto zsz = std::max( ( std::min( m_vd.zvEnd, end ) - std::max( m_vd.zvStart, ev.start.Val() ) ) * pxns, pxns * 0.5 );
|
||||||
if( zsz < MinVisSize )
|
if( zsz < MinVisSize )
|
||||||
{
|
{
|
||||||
const auto MinVisNs = MinVisSize * nspx;
|
const auto MinVisNs = MinVisSize * nspx;
|
||||||
@ -243,7 +243,7 @@ int View::DrawGhostLevel( const Vector<GhostZone>& vec, bool hover, double pxns,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
ImGui::PushClipRect( wpos + ImVec2( px0, offset ), wpos + ImVec2( px1, offset + tsz.y * 2 ), true );
|
ImGui::PushClipRect( wpos + ImVec2( px0, offset ), wpos + ImVec2( px1, offset + tsz.y * 2 ), true );
|
||||||
DrawTextContrast( draw, wpos + ImVec2( ( ev.start.Val() - m_vd.zvStart ) * pxns, offset ), txtColor, symName );
|
DrawTextContrast( draw, wpos + ImVec2( std::max( int64_t( 0 ), ev.start.Val() - m_vd.zvStart ) * pxns, offset ), txtColor, symName );
|
||||||
ImGui::PopClipRect();
|
ImGui::PopClipRect();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -330,7 +330,7 @@ int View::SkipGhostLevel( const Vector<GhostZone>& vec, bool hover, double pxns,
|
|||||||
{
|
{
|
||||||
auto& ev = *it;
|
auto& ev = *it;
|
||||||
const auto end = ev.end.Val();
|
const auto end = ev.end.Val();
|
||||||
const auto zsz = std::max( ( end - ev.start.Val() ) * pxns, pxns * 0.5 );
|
const auto zsz = std::max( ( std::min( m_vd.zvEnd, end ) - std::max( m_vd.zvStart, ev.start.Val() ) ) * pxns, pxns * 0.5 );
|
||||||
if( zsz < MinVisSize )
|
if( zsz < MinVisSize )
|
||||||
{
|
{
|
||||||
const auto MinVisNs = MinVisSize * nspx;
|
const auto MinVisNs = MinVisSize * nspx;
|
||||||
@ -429,7 +429,7 @@ int View::DrawZoneLevel( const V& vec, bool hover, double pxns, int64_t nspx, co
|
|||||||
{
|
{
|
||||||
auto& ev = a(*it);
|
auto& ev = a(*it);
|
||||||
const auto end = m_worker.GetZoneEnd( ev );
|
const auto end = m_worker.GetZoneEnd( ev );
|
||||||
const auto zsz = std::max( ( end - ev.Start() ) * pxns, pxns * 0.5 );
|
const auto zsz = std::max( ( std::min( m_vd.zvEnd, end ) - std::max( m_vd.zvStart, ev.Start() ) ) * pxns, pxns * 0.5 );
|
||||||
if( zsz < MinVisSize )
|
if( zsz < MinVisSize )
|
||||||
{
|
{
|
||||||
const auto MinVisNs = MinVisSize * nspx;
|
const auto MinVisNs = MinVisSize * nspx;
|
||||||
@ -595,7 +595,7 @@ int View::DrawZoneLevel( const V& vec, bool hover, double pxns, int64_t nspx, co
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
ImGui::PushClipRect( wpos + ImVec2( px0, offset ), wpos + ImVec2( px1, offset + tsz.y * 2 ), true );
|
ImGui::PushClipRect( wpos + ImVec2( px0, offset ), wpos + ImVec2( px1, offset + tsz.y * 2 ), true );
|
||||||
DrawTextContrast( draw, wpos + ImVec2( ( ev.Start() - m_vd.zvStart ) * pxns, offset ), 0xFFFFFFFF, zoneName );
|
DrawTextContrast( draw, wpos + ImVec2( std::max( int64_t( 0 ), ev.Start() - m_vd.zvStart ) * pxns, offset ), 0xFFFFFFFF, zoneName );
|
||||||
ImGui::PopClipRect();
|
ImGui::PopClipRect();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -651,7 +651,7 @@ int View::SkipZoneLevel( const V& vec, bool hover, double pxns, int64_t nspx, co
|
|||||||
{
|
{
|
||||||
auto& ev = a(*it);
|
auto& ev = a(*it);
|
||||||
const auto end = m_worker.GetZoneEnd( ev );
|
const auto end = m_worker.GetZoneEnd( ev );
|
||||||
const auto zsz = std::max( ( end - ev.Start() ) * pxns, pxns * 0.5 );
|
const auto zsz = std::max( ( std::min( m_vd.zvEnd, end ) - std::max( m_vd.zvStart, ev.Start() ) ) * pxns, pxns * 0.5 );
|
||||||
if( zsz < MinVisSize )
|
if( zsz < MinVisSize )
|
||||||
{
|
{
|
||||||
const auto MinVisNs = MinVisSize * nspx;
|
const auto MinVisNs = MinVisSize * nspx;
|
||||||
|
Loading…
Reference in New Issue
Block a user