Skip to content

Commit 758080e

Browse files
authored
Merge pull request wolfpld#886 from mcourteaux/master
Fix inheriting color bug.
2 parents 44d1502 + 0f60028 commit 758080e

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

profiler/src/profiler/TracyTimelineItemThread.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ int TimelineItemThread::PreprocessGhostLevel( const TimelineContext& ctx, const
400400
}
401401
#endif
402402

403-
int TimelineItemThread::PreprocessZoneLevel( const TimelineContext& ctx, const Vector<short_ptr<ZoneEvent>>& vec, int depth, bool visible, uint32_t inheritedColor )
403+
int TimelineItemThread::PreprocessZoneLevel( const TimelineContext& ctx, const Vector<short_ptr<ZoneEvent>>& vec, int depth, bool visible, const uint32_t inheritedColor )
404404
{
405405
if( vec.is_magic() )
406406
{
@@ -413,7 +413,7 @@ int TimelineItemThread::PreprocessZoneLevel( const TimelineContext& ctx, const V
413413
}
414414

415415
template<typename Adapter, typename V>
416-
int TimelineItemThread::PreprocessZoneLevel( const TimelineContext& ctx, const V& vec, int depth, bool visible, uint32_t inheritedColor )
416+
int TimelineItemThread::PreprocessZoneLevel( const TimelineContext& ctx, const V& vec, int depth, bool visible, const uint32_t inheritedColor )
417417
{
418418
const auto vStart = ctx.vStart;
419419
const auto vEnd = ctx.vEnd;
@@ -458,6 +458,7 @@ int TimelineItemThread::PreprocessZoneLevel( const TimelineContext& ctx, const V
458458
{
459459
const auto hasChildren = ev.HasChildren();
460460
auto currentInherited = inheritedColor;
461+
auto childrenInherited = inheritedColor;
461462
if( m_view.GetViewData().inheritParentColors )
462463
{
463464
uint32_t color = 0;
@@ -474,12 +475,12 @@ int TimelineItemThread::PreprocessZoneLevel( const TimelineContext& ctx, const V
474475
if( color != 0 )
475476
{
476477
currentInherited = color | 0xFF000000;
477-
if( hasChildren ) inheritedColor = DarkenColorSlightly( color );
478+
if( hasChildren ) childrenInherited = DarkenColorSlightly( color );
478479
}
479480
}
480481
if( hasChildren )
481482
{
482-
const auto d = PreprocessZoneLevel( ctx, m_worker.GetZoneChildren( ev.Child() ), depth + 1, visible, inheritedColor );
483+
const auto d = PreprocessZoneLevel( ctx, m_worker.GetZoneChildren( ev.Child() ), depth + 1, visible, childrenInherited );
483484
if( d > maxdepth ) maxdepth = d;
484485
}
485486
if( visible ) m_draw.emplace_back( TimelineDraw { TimelineDrawType::Zone, uint16_t( depth ), (void**)&ev, 0, 0, currentInherited } );

profiler/src/profiler/TracyTimelineItemThread.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ class TimelineItemThread final : public TimelineItem
3737
#ifndef TRACY_NO_STATISTICS
3838
int PreprocessGhostLevel( const TimelineContext& ctx, const Vector<GhostZone>& vec, int depth, bool visible );
3939
#endif
40-
int PreprocessZoneLevel( const TimelineContext& ctx, const Vector<short_ptr<ZoneEvent>>& vec, int depth, bool visible, uint32_t inheritedColor );
40+
int PreprocessZoneLevel( const TimelineContext& ctx, const Vector<short_ptr<ZoneEvent>>& vec, int depth, bool visible, const uint32_t inheritedColor );
4141

4242
template<typename Adapter, typename V>
43-
int PreprocessZoneLevel( const TimelineContext& ctx, const V& vec, int depth, bool visible, uint32_t inheritedColor );
43+
int PreprocessZoneLevel( const TimelineContext& ctx, const V& vec, int depth, bool visible, const uint32_t inheritedColor );
4444

4545
void PreprocessContextSwitches( const TimelineContext& ctx, const ContextSwitch& ctxSwitch, bool visible );
4646
void PreprocessSamples( const TimelineContext& ctx, const Vector<SampleData>& vec, bool visible, int yPos );

0 commit comments

Comments
 (0)