@@ -1210,15 +1210,10 @@ String Component::getPaintProfileName() const
12101210 return " Component" ;
12111211}
12121212
1213- // ==============================================================================
1213+ thread_local std::vector<PaintProfileScopeEntry> Component::paintProfileScopeStack {};
1214+ std::atomic<uint64> Component::globalPaintIndexCounter { 0 };
12141215
1215- struct PaintProfileScopeEntry
1216- {
1217- double childrenMicros = 0.0 ;
1218- };
1219-
1220- thread_local std::vector<PaintProfileScopeEntry> paintProfileScopeStack;
1221- static std::atomic<uint64> globalPaintIndexCounter { 0 };
1216+ // ==============================================================================
12221217
12231218class PaintProfileScope
12241219{
@@ -1233,20 +1228,20 @@ class PaintProfileScope
12331228 , selfStartMicros (0.0 )
12341229 {
12351230 sample.frameIndex = frameIndex;
1236- sample.paintIndex = globalPaintIndexCounter.fetch_add (1 , std::memory_order_relaxed);
1231+ sample.paintIndex = Component:: globalPaintIndexCounter.fetch_add (1 , std::memory_order_relaxed);
12371232 sample.repaintArea = repaintArea;
12381233 sample.componentBounds = component.getBoundsRelativeToTopLevelComponent ().to <float >();
12391234 sample.renderContinuous = renderContinuous;
12401235
1241- paintProfileScopeStack.push_back ({});
1236+ Component:: paintProfileScopeStack.push_back ({});
12421237 }
12431238
12441239 ~PaintProfileScope ()
12451240 {
12461241 const double totalEndMicros = ticksToMicros (Time::getHighResolutionTicks ());
12471242 sample.totalMicros = totalEndMicros - totalStartMicros;
1248- sample.childrenMicros = paintProfileScopeStack.back ().childrenMicros ;
1249- paintProfileScopeStack.pop_back ();
1243+ sample.childrenMicros = Component:: paintProfileScopeStack.back ().childrenMicros ;
1244+ Component:: paintProfileScopeStack.pop_back ();
12501245
12511246 sample.frameworkMicros = std::max (0.0 ,
12521247 sample.totalMicros
@@ -1256,8 +1251,8 @@ class PaintProfileScope
12561251 if (auto * stats = component.getPaintProfileStats ())
12571252 stats->recordSample (sample);
12581253
1259- if (! paintProfileScopeStack.empty ())
1260- paintProfileScopeStack.back ().childrenMicros += sample.totalMicros ;
1254+ if (! Component:: paintProfileScopeStack.empty ())
1255+ Component:: paintProfileScopeStack.back ().childrenMicros += sample.totalMicros ;
12611256 }
12621257
12631258 void beginSelf ()
0 commit comments