@@ -216,14 +216,12 @@ class ProfilerDashboard : public yup::Component
216216 font = theme->getDefaultFont ();
217217 }
218218
219- #if YUP_ENABLE_COMPONENT_PAINT_PROFILING
220219 void setSnapshot (const yup::PaintProfiler::Snapshot& newSnapshot, int selectedIndex)
221220 {
222221 snapshot = newSnapshot;
223222 selectedRow = selectedIndex;
224223 repaint ();
225224 }
226- #endif
227225
228226 int getSelectedRow () const { return selectedRow; }
229227
@@ -236,22 +234,13 @@ class ProfilerDashboard : public yup::Component
236234 g.setFillColor (yup::Color (0xff1a1a2e ));
237235 g.fillAll ();
238236
239- #if YUP_ENABLE_COMPONENT_PAINT_PROFILING
240237 const float divX = bounds.getWidth () * 0 .60f ;
241238 drawTable (g, bounds.withWidth (divX));
242239 drawRightPanel (g, bounds.withX (divX + 4 .0f ).withWidth (bounds.getWidth () - divX - 4 .0f ));
243- #else
244- g.setFillColor (yup::Colors::lightgray);
245- g.fillFittedText (" Paint profiling not enabled (build with YUP_ENABLE_COMPONENT_PAINT_PROFILING=1)" ,
246- font,
247- bounds,
248- yup::Justification::center);
249- #endif
250240 }
251241
252242 void mouseDown (const yup::MouseEvent& event) override
253243 {
254- #if YUP_ENABLE_COMPONENT_PAINT_PROFILING
255244 const float divX = getLocalBounds ().to <float >().getWidth () * 0 .60f ;
256245 if (event.getPosition ().getX () >= divX)
257246 return ;
@@ -262,12 +251,9 @@ class ProfilerDashboard : public yup::Component
262251 if (row >= 0 && row < (int ) snapshot.components .size ())
263252 selectedRow = row;
264253 repaint ();
265- #endif
266254 }
267255
268256private:
269- #if YUP_ENABLE_COMPONENT_PAINT_PROFILING
270-
271257 static constexpr float kMaxColW = 62 .0f ;
272258 static constexpr float kAvgColW = 62 .0f ;
273259 static constexpr float kHeaderH = 24 .0f ;
@@ -511,7 +497,6 @@ class ProfilerDashboard : public yup::Component
511497 }
512498
513499 yup::PaintProfiler::Snapshot snapshot;
514- #endif
515500
516501 int selectedRow = -1 ;
517502 yup::Font font;
@@ -546,12 +531,10 @@ class ProfilerWindow : public yup::DocumentWindow
546531 yup::MessageManager::callAsync (closeCallback);
547532 }
548533
549- #if YUP_ENABLE_COMPONENT_PAINT_PROFILING
550534 void updateSnapshot (const yup::PaintProfiler::Snapshot& snap)
551535 {
552536 dashboard->setSnapshot (snap, dashboard->getSelectedRow ());
553537 }
554- #endif
555538
556539private:
557540 std::unique_ptr<ProfilerDashboard> dashboard;
@@ -581,9 +564,7 @@ class PaintProfilerDemo : public yup::Component
581564 nestedGrid = std::make_unique<NestedWidgetGrid>();
582565 addAndMakeVisible (nestedGrid.get ());
583566
584- #if YUP_ENABLE_COMPONENT_PAINT_PROFILING
585567 paintProfileSession = yup::PaintProfiler::getInstance ().startSession (*this );
586- #endif
587568
588569 startTimerHz (10 );
589570 }
@@ -592,10 +573,7 @@ class PaintProfilerDemo : public yup::Component
592573 {
593574 stopTimer ();
594575 profilerWindow.reset ();
595-
596- #if YUP_ENABLE_COMPONENT_PAINT_PROFILING
597576 paintProfileSession.reset ();
598- #endif
599577 }
600578
601579 void paint (yup::Graphics& g) override
@@ -619,7 +597,6 @@ class PaintProfilerDemo : public yup::Component
619597
620598 void timerCallback () override
621599 {
622- #if YUP_ENABLE_COMPONENT_PAINT_PROFILING
623600 if (paintProfileSession == nullptr || paintProfileSession->isPaused ())
624601 return ;
625602
@@ -628,12 +605,10 @@ class PaintProfilerDemo : public yup::Component
628605
629606 auto snap = paintProfileSession->createSnapshot (yup::PaintProfileTimeKind::total, 32 );
630607 profilerWindow->updateSnapshot (snap);
631- #endif
632608 }
633609
634610 void keyDown (const yup::KeyPress& keys, const yup::Point<float >& position) override
635611 {
636- #if YUP_ENABLE_COMPONENT_PAINT_PROFILING
637612 if (keys.getKey () == yup::KeyPress::textPKey)
638613 {
639614 toggleProfilerWindow ();
@@ -647,7 +622,6 @@ class PaintProfilerDemo : public yup::Component
647622 {
648623 logSnapshot ();
649624 }
650- #endif
651625 }
652626
653627private:
@@ -669,7 +643,6 @@ class PaintProfilerDemo : public yup::Component
669643 }
670644 }
671645
672- #if YUP_ENABLE_COMPONENT_PAINT_PROFILING
673646 void logSnapshot ()
674647 {
675648 if (paintProfileSession == nullptr )
@@ -700,15 +673,11 @@ class PaintProfilerDemo : public yup::Component
700673 globalBuckets += " " + yup::String (c);
701674 yup::Logger::outputDebugString (globalBuckets);
702675 }
703- #endif
704676
705677 std::unique_ptr<OpaqueBackgroundWidget> opaqueWidget;
706678 std::unique_ptr<PathDrawingWidget> pathWidget;
707679 std::unique_ptr<TextGradientWidget> textWidget;
708680 std::unique_ptr<NestedWidgetGrid> nestedGrid;
709681 std::unique_ptr<ProfilerWindow> profilerWindow;
710-
711- #if YUP_ENABLE_COMPONENT_PAINT_PROFILING
712682 std::unique_ptr<yup::PaintProfiler::ScopedSession> paintProfileSession;
713- #endif
714683};
0 commit comments